Next.js Discord

Discord Forum

Nextjs 14 always responds with 404 Not Found when using API routes

Answered
Common Black-Hawk posted this in #help-forum
Open in Discord
Common Black-HawkOP
hello iam new to nextjs and when i try to do api/route i always get 404
Answered by Common Black-Hawk
is restarted me pc
View full answer

23 Replies

Common Black-HawkOP
i use the app routing
so the file is in
app/api/get/route.js
Himalayan
Remove /route.js at the end of your url
it should just be "/api/get"
@Himalayan Remove /route.js at the end of your url
Common Black-HawkOP
I already tried
Himalayan
Try and open the devtools and go into network and see the request there
You should be able to see the status and response
Common Black-HawkOP
Himalayan
Not sure what it could be then... that exact code works for me
@Himalayan Not sure what it could be then... that exact code works for me
Common Black-HawkOP
i dont use the src option tho
is that the issue maybe?
Himalayan
Nah the src directory is optional
Have you tried to restart the next server?
Common Black-HawkOP
yeah
this shit is annyogin
Common Black-HawkOP
is restarted me pc
Answer
Common Black-HawkOP
and it worked
I can tell ya that there are thousands of people that use nextjs every day and dont run into this issue as it would be pretty catastrophic.
problem i did smethign wrng