N
Nuxt6mo ago
Neamix

Nitro server work only on local

I my routes in nuxt nitro server and it was fine on localhost but after deploy this routes return 404 to me here is an example to one of my server routes
export default defineEventHandler(async (event) => {
const body = await readBody(event);
let route = body.domain+'/api/user/phone/count';
console.log(route);
return await $fetch(route, {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
method: 'post',
body: {
phone: body.phone,
countryCode: body.countryCode
}
})
})
export default defineEventHandler(async (event) => {
const body = await readBody(event);
let route = body.domain+'/api/user/phone/count';
console.log(route);
return await $fetch(route, {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
method: 'post',
body: {
phone: body.phone,
countryCode: body.countryCode
}
})
})
1 Reply
Cue
Cue6mo ago
What’s returning the 404, the call to your server route or the call to the route inside your handler?

Did you find this page helpful?