NuxtN
Nuxt2y ago
Neamix

Get api domain in nitro server file

Greeting i created server route that go to api and check the phone if it exist before or not here it's
export default defineEventHandler(async (event) => {
  let config = useRuntimeConfig();
  let domain = config.public.apiURL; 
  let route = domain+'/api/user/phone/count';
  const body  = await readBody(event);
  return await $fetch(route, {
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    },
    method: 'post',
    body: {
      phone: body.phone,
      countryCode: body.countryCode
    }
  })
})


and here it my env file
apiURL=https://app.rifq.me


every thing is cool on local but on production i got File not found error (Note: api route is same on local and prod)
Was this page helpful?