Reputation: 281
How to create an api route which is inside a api folder. I want to separte my view and api files. Here api>users.js (api/users) is not working. But if i create a file name api.users.js (api/users) inside routes it works and also the api>index.js (/api). I need to keep my api files in a folder.
Upvotes: 0
Views: 1010
Reputation: 20322
Remix v2
flat files convention prevents you from using folders for nested routes. It only supports folders for colocation.
You can switch back to the v1
convention using the package @remix-run/v1-route-convention
https://github.com/remix-run/v1-compat-utils/tree/main/packages/v1-route-convention
Upvotes: 1