Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add apiDir config option #8162

Closed
cj opened this issue Jul 29, 2019 · 7 comments
Closed

Add apiDir config option #8162

cj opened this issue Jul 29, 2019 · 7 comments

Comments

@cj
Copy link

cj commented Jul 29, 2019

It would be great to be able to specify the API dir location, please refer to https://spectrum.chat/next-js/general/next-9-is-there-a-config-option-to-change-where-the-api-dir-is-located~81da11ce-cd38-4fb5-bcda-9e95ee07db14

@ijjk
Copy link
Member

ijjk commented Jul 29, 2019

duplicate of #8123

@ijjk ijjk closed this as completed Jul 29, 2019
@cj
Copy link
Author

cj commented Jul 29, 2019

@ijjk This is not a duplicate, this is not about changing the API route, it's about changing the API dir location. Please refer to https://spectrum.chat/next-js/general/next-9-is-there-a-config-option-to-change-where-the-api-dir-is-located~81da11ce-cd38-4fb5-bcda-9e95ee07db14

@ijjk
It's more for organisation and separation of concerns. We consider pages just that, pages, each one relates to a page you can visit, where as the API is the API an endpoint we consume. Because we are also connecting to a graphql backend to consume our data (which allows you to request everything in a single request) and since the release of serverless pre-rendering we are creating an endpoint for each of our pages to consume, i.e. api/pages/index etc... so right now that looks like /pages/api/pages/index, which gets confusing.

@cj
Copy link
Author

cj commented Jul 29, 2019

i.e. so instead of the dir location being /pages/api you could make it just /api, the route would not change.

@cj
Copy link
Author

cj commented Jul 29, 2019

I hope this makes sense 😄

Ideally it would be great to have both options, apiDir and apiRoutePath to allow for maximum flexibility.

@ijjk
Copy link
Member

ijjk commented Jul 29, 2019

I see, can you open a new feature request issue following the issue template

@cj
Copy link
Author

cj commented Jul 29, 2019

@ijjk done, sorry about the confusion! #8165

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants