DEV Community

Discussion on: A 2021 guide about structuring your Next.js project in a flexible and efficient way

Collapse
 
mtrogers profile image
mtrogers

This was awesome, thank you.

Do you have an example codebase using this structure, to see it a little more concrete?

I'm coming from express routing for apis, and so I'm a little confuddled by how I should organize things. If I have a folder structure like
/modules
/auth
/api
AuthAPI.js
/components
auth.js
/pages
/api
/authAPI
authAPI.js
What kind of functions go in /modules/auth/api/AuthAPI? /modules/auth/auth.js?
What kind of functions go in /pages/api/authAPI/authAPI.js?

Collapse
 
mtrogers profile image
mtrogers

Also, is [name]API.js your shorthand for all the other ones, or is that your "router" ?