Express to Next 13 Question
Unanswered
Wuchang bream posted this in #help-forum
Wuchang breamOP
The docs feels like it is missing some info for Next 13. I just migrated from create-react-app to NextJS, but now I need to migrate my express server to NextJS as well.
For anyone who is familiar with both, do I need to create a new folder for each route and then a new file for each controller function?
So, what would be this in express:
Would be this is NextJS:
For anyone who is familiar with both, do I need to create a new folder for each route and then a new file for each controller function?
So, what would be this in express:
/
├── index.js
├── controllers
│ └── product.js
└── routes
└── product.js
controllers/product.js
├── getProduct
└── getAllProducts
Would be this is NextJS:
├── app
└── api
└── products
├── getProduct.js
└── getAllProducts.js
3 Replies
Alfonsus Ardani
Next.js is only conerned about the final routing structure that the user will use.
Regarding the controller folders like
Regarding the controller folders like
/controllers
is completely up to youanything that is inside the
app
folder (or pages
folder) will be used to process the final routing structure of the applicationYou can still put stuff inside
app
like app/products/getProduct.js
and it wont be read by Next.js since its not a valid Next.js file.