Post request to page path
Hi there
I'm trying to integrate my nuxt app with an external service, however that service sends a POST request to my sign up page with a JWT token
If I add a route that is identical to a page route with an
index.post.ts
filename, is it possible for that to coexist with the regular nuxt page? Or would I have to create some kind of "interim" route that if get forwards them to a frontend route?
Thanks!4 Replies
Having two files named
index.ts
and index.post.ts
is possible, yes.
(Usually you can also provide a callback url to your auth service to redirect that post request)However I don't have an index.ts
pages/auth/signin.vue
is a nuxt page
server/routes/auth/signin/index.post.ts
is a server handler
Is this ok and possible?sure, absolutely
pages/auth/signin.vue
== pages/auth/signin/index.vue
you could also name the server route server/routes/auth/signin.post.ts
Ahhh gotcha! Perfect thanks!