framework
framework copied to clipboard
Server Routes documentation : ~/server/api vs ~/server/routes
Describe the feature
The v3 documentation doesn't really explain the real difference between routes
and api
directories inside the server
dir.
Apart from "If you don't want to use ~/server/api
, you can use ~/server/routes
instead", we can't really understand their meaning.
• Why were they created in the first place?
• When should I use routes
instead of api
?
The Nitro doc doesn't answer these questions either.
PS It may be great to add a "✍️ Doc upgrade" option to this list.
Additional information
- [ ] Would you be willing to help implement this feature?
- [ ] Could this feature be implemented as a module?
Final checks
- [X] Read the contribution guide.
- [X] Check existing discussions and issues.
Hi, i find it clear in the doc, there is even an example, it's just a path name choice. I could want to name my api endpoint https://ww.foo.com/barApi instead of https://www.foo.com/api/bar. If you don't want the /api/ part, you place it in a server/route folder.
PR welcome to improve the docs.
Thanks @Joaojack, I thought there was something more profound I didn't get 😂
Docs for reference:
https://v3.nuxtjs.org/guide/directory-structure/server#server-directory