N
Nuxt5mo ago
Wazbat

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
Flo
Flo5mo ago
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)
Wazbat
Wazbat5mo ago
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?
Flo
Flo5mo ago
sure, absolutely pages/auth/signin.vue == pages/auth/signin/index.vue you could also name the server route server/routes/auth/signin.post.ts
Wazbat
Wazbat5mo ago
Ahhh gotcha! Perfect thanks!
Want results from more Discord servers?
Add your server