Next.js Discord

Discord Forum

Api keeps giving 404 error

Unanswered
Birman posted this in #help-forum
Open in Discord
BirmanOP

17 Replies

share the path you are trying to access, and what do you get when you try to access it?
BirmanOP
postman gves this when i try to access the api route
working fine for me, are you sure you're accessing correct server?
BirmanOP
yes i am sure
@Birman postman gves this when i try to access the api route
this postman is local? Like is postman installed? Or is this the web version?
I would assume it's the local version, since it is able to access the next.js server
just the api is shown as 404
try restarting server
@averydelusionalperson try restarting server
BirmanOP
tried it
can you access other paths/pages?
@Birman Click to see attachment
Some causes that I can imagine:
1. OP has both src/app and app
2. OP’s middleware is doing some shenanigans to block /api
yeah, if possible share your entire directory.
BirmanOP
thanks i fixed it
why does this code without headers gives a html response and 404 error and with header gives a json response
@Birman thanks i fixed it
How did you do that?