The next step in the MDN express tutorial sets up all the routes and controllers you’re going to need when creating the Library project. This project is designed using the MVC (Model, View, Controller) architecture. In a previous step you set up all the Models (or Database Objects) and in the next step you’ll be setting up several different views.
If you remember from our earlier lessons, the controller is the code that sits between the models and the views. It determines which view is going to be shown, as well as which information is going to populate that view. In this lesson, you will copy and paste quite a bit of repetitive code to get the controllers and routes set up, but be sure to read everything in between them! There is a lot of useful information therein.
By the end of this lesson, you should be able to do the following:
- Create simple routes.
- Create route-handler callback functions.
- Create a catalog route module.
- Describe approaches for structuring routes and controllers.
- Set up URL endpoints.
- Continue where we left off with part 4 of the Express tutorial
This section contains questions for you to check your understanding of this lesson. If you’re having trouble answering the questions below on your own, review the material above to find the answer.
This section contains helpful links to related content. It isn’t required, so consider it supplemental.
- It looks like this lesson doesn’t have any additional resources yet. Help us expand this section by contributing to our curriculum.