#/api/ missing from request URL

20 messages · Page 1 of 1 (latest)

muted edge
#

localhost:3000 when using the useFetch hook Nuxt 3 Provides the request URL is missing the "/api/" path to my server. Any idea on what I am missing? I thought this was automatically registered? This App is a Nuxt-bridge transition into Nuxt 3.

sorry no repo because this is a government facing application.

dapper fable
#

whay do u mean

#

can u give some code example?

muted edge
#

@dapper fable

const getQueues = async () => {
  const { data } = await useFetch("/resources/user/work-queue-aggregate")
    queues.value = data
}
dapper fable
#

in what file u use that?

#

and u did define route in server/api/user/work-queue-aggregate?

muted edge
dapper fable
#

then u need

#

const getQueues = async () => {
const { data } = await useFetch("/api/resources/user/work-queue-aggregate")
queues.value = data
}

#

coz its under api folder

muted edge
dapper fable
#

it is but

#

for nuxt to distinguish

#

real pages routes

#

from server routes

#

api is predefined for server routes

#

not to collide with eachother

#

since it shares same port

#

and server

muted edge
#

Oh understandable, Thank you!