Next.js Discord

Discord Forum

How to serve a React regular page at `/api/*`?

Unanswered
Birman posted this in #help-forum
Open in Discord
BirmanOP
I'm migrating a site and it has some existing routes for HTML pages at /api/.... Is there a way to rename or disable the api folder so that I can serve pages there?

6 Replies

Asian black bear
I am pretty sure it is disabled by default in /app router pages
yeah, if you use the /app router the /api folder has no special meaning, you can have normal pages there. a route is only a route handler if you add the route.ts file
Asian black bear
That is a much better explanation
BirmanOP
Yeah I'm still not on app router yet, but I guess all signs point to using it at this point
Thanks y'all!
@Birman Yeah I'm still not on app router yet, but I guess all signs point to using it at this point
fyi you can incrementally adopt the app folder so you can create only a single route there and keep the rest of the app with the pages folder so you don't need to do all at once