Random Notes on Express vs Next


Uncategorized

Updated Feb 23rd, 2022

On the mapping of a full stack JavaScript app to a next JS app.

In the full stack JS project the router defines what happens when you go to specific routes with a specific request types. Athens says which function or functions should be called when that route is hit.

Functions are used to do all sorts of things such as render templates so you may see functions like profilePostsScreen.

In the controller file you define these functions. If there are multiple function called in the router, than in the controller you will need, in addition to req, and res, next.

It is in these controller files where you can call the functions defined in the model files, which can be set up to return a promise. So we will see .then.catch in the controller file functions.

As mentioned, it is in the model file functions we want to create our won