Use POST on same path as Page route
Answered
Eurasian Hobby posted this in #help-forum
Eurasian HobbyOP
Since route.js cannot be at the same route segment level as page.js, does this mean it's impossible for a single route to handle a page display and a POST api call?
I want to display a page at https://localhost:3000/ and also handle a POST request at https://localhost:3000/.
I want to display a page at https://localhost:3000/ and also handle a POST request at https://localhost:3000/.
Answered by aardani
you can try creating route.ts at
/ and redirecting to somewhere else if its a GET4 Replies
you can try creating route.ts at
/ and redirecting to somewhere else if its a GETAnswer
Eurasian HobbyOP
Thanks @aardani . This is the solution that I landed on as well. I just wanted to make sure I didn't miss something.
TIL that it works lol