Next.js Discord

Discord Forum

App router and API dir

Unanswered
Gouty oak gall posted this in #help-forum
Open in Discord
Gouty oak gallOP
I seem to have gotten myself confused. In a next.js app I plan to deploy to vercel (using app router) is the api directory special? Is it /app/api or /api ?

Right now I have /app/api/getcount/route.ts , but my API is not being found.

Full repo here:
https://github.com/apsquared/apsquared-template

10 Replies

Gouty oak gallOP
Still stuck!
Variegated Flycatcher
Please provide more explicit context: where is it used?
Gouty oak gallOP
I’m just trying to hit the endpoint directly in my browser. http://localhost:3000/api/getcount?type=test
Variegated Flycatcher
What's the error? How does it fail? Please provide details.
Going fine on a relative limited example:
Gouty oak gallOP
404
This page could not be fund
None of the console logs are printing
Variegated Flycatcher
There are some custom nextjs configuration settings.
Try with a brand new project (not a template).