Nuxt /app Pages Not Detecting API Route from /server Directory
Hello,
I am using the new Nuxt /app directory structure for pages, but unfortunately, these pages are not able to detect the /server/api/auth/register.ts API route. I'm receiving the following warning in the console:
Any insights on how to resolve this issue?
7 Replies
app/pages/auth/register.vue file scripts:
server/api/auth/register.post.ts file:
Please use this when sharing code
How to Create a Coloured Code Block:
https://www.geeksforgeeks.org/how-to-format-text-into-code-block-on-discord/
GeeksforGeeks
How to Format Text Into Code Block on Discord
Here are the following steps to format text into code block on discord : Step 1: Open Discord ;Step 2: Navigate to the server;
As for the error
Are you sure you saved the file
And maybe try to restart the dev server
Typically that's when I face this issue
yes I saved it, I tried rebooting but it didn't work.
the new nuxt system includes the contents in the app folder and does not see the server folder in the root folder
when I take everything out of the app folder it works fine, it's weird. when defining the path I tried things like ../ or ~/ but again it didn't work.
Oh, you are using the nuxt4 patch ?
The server folder should not be inside the app folder
Vue Mastery
Upgrading to Nuxt 4 | Vue Mastery
Nuxt 4 introduces performance upgrades and API consistency. Learn about the new folder structure, caching data, and other changes in this tutorial.