NEXT edge api routes: sending a json response
I'm currently migrating my app to work with edge
worked fine so far until i tried to return json to the frontend, then the frontend was complaining with
SyntaxError: Unexpected end of JSON input
I just followed the examples from nextjs guide (pages router in particular), but it seems this isn't the right way to send json to the frontend, how should i do it?
edge runtime code:
It's erroring out on this part in particular(on the frontend):
1 Reply
Old code using normal NEXTjs runtime (works just fine):
----
on a related note, how do i set two cookies with
Response
?
is it this way?:
it also doesn't help that there's barely anything about the Response constructor on MDN