Next.js: Add configuration option to disable API routing.

Created on 23 Apr 2020  路  2Comments  路  Source: vercel/next.js

Feature request

Is your feature request related to a problem? Please describe.

I'm trying to use /api as a landing page that introduces users to the product's API and links them to the full documentation, but I can't find any way to disable Next's API routing - instead, it just tries to turn the page into an API endpoint.

https://nextjs.org/docs/api-routes/introduction

Describe the solution you'd like

It'd be useful to have a configuration option to disable API routing for sites built on Next that are purely for marketing purposes.

Describe alternatives you've considered

I couldn't find any relevant configuration options and all of the other issues I was able to find on Google and GitHub involved redirecting from /api to a different route. I'm most likely going to go with that option if no other solution presents itself (it's not ideal, but at least the user would get redirected to the right place), but it seems odd that this feature is enforced with no way to opt-out.

good first issue

Most helpful comment

Sorry @Kurnett
I hook your post to ask if it could be possible to have a config in next.config.js to change the /api directory to another name ?

All 2 comments

Sorry @Kurnett
I hook your post to ask if it could be possible to have a config in next.config.js to change the /api directory to another name ?

Feel free to send a PR to make /api (only pages/api.js) work as a React page.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jesselee34 picture jesselee34  路  3Comments

YarivGilad picture YarivGilad  路  3Comments

havefive picture havefive  路  3Comments

knipferrc picture knipferrc  路  3Comments

sospedra picture sospedra  路  3Comments