Next.js Discord

Discord Forum

Dealing with content negotiation

Unanswered
Tomistoma posted this in #help-forum
Open in Discord
TomistomaOP
What would be the best way to go about implementing content negotiation in NextJS? For example, if I made a GET request to /foo with Accept: */*, it would return the HTML for the page, however if set the header to Accept: application/json then it would return a JSON representation for the page.
I'm assuming it's going to be something middleware related, but I can't seem to find much about it/if it's been done before, so I'm wondering if there's any example.

0 Replies