Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a new relevant assignment: add a new assignment to express(103 routes and controllers ) #27693

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### Introduction

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.

Check failure on line 3 in nodeJS/express_and_mongoose/express_103_routes_and_controllers.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Emphasis style

nodeJS/express_and_mongoose/express_103_routes_and_controllers.md:3:295 MD049/emphasis-style Emphasis style [Expected: asterisk; Actual: underscore] https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md049.md

Check failure on line 3 in nodeJS/express_and_mongoose/express_103_routes_and_controllers.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Emphasis style

nodeJS/express_and_mongoose/express_103_routes_and_controllers.md:3:300 MD049/emphasis-style Emphasis style [Expected: asterisk; Actual: underscore] https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md049.md

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.

Check failure on line 5 in nodeJS/express_and_mongoose/express_103_routes_and_controllers.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Emphasis style

nodeJS/express_and_mongoose/express_103_routes_and_controllers.md:5:394 MD049/emphasis-style Emphasis style [Expected: asterisk; Actual: underscore] https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md049.md

Check failure on line 5 in nodeJS/express_and_mongoose/express_103_routes_and_controllers.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Emphasis style

nodeJS/express_and_mongoose/express_103_routes_and_controllers.md:5:398 MD049/emphasis-style Emphasis style [Expected: asterisk; Actual: underscore] https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md049.md

### Lesson overview

Expand All @@ -19,12 +19,14 @@
<div class="lesson-content__panel" markdown="1">

1. Complete part 4 of [the MDN Express tutorial](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/routes).
2. Back to the Mini Message Board project, create a new directory called `controllers` to store the callback functions for

Check failure on line 22 in nodeJS/express_and_mongoose/express_103_routes_and_controllers.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Trailing spaces

nodeJS/express_and_mongoose/express_103_routes_and_controllers.md:22:123 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1] https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md009.md

Check failure on line 22 in nodeJS/express_and_mongoose/express_103_routes_and_controllers.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Ordered list item prefix

nodeJS/express_and_mongoose/express_103_routes_and_controllers.md:22:1 MD029/ol-prefix Ordered list item prefix [Expected: 1; Actual: 2; Style: 1/1/1] https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md029.md
your route handlers. Create a new file called `messageController.js` and move the callback functions from `index.js` to this new file.

</div>

### Knowledge check

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.

Check failure on line 29 in nodeJS/express_and_mongoose/express_103_routes_and_controllers.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Sections have default content

nodeJS/express_and_mongoose/express_103_routes_and_controllers.md:29 TOP003/default-section-content Sections have default content [Expected: "The following questions are an opportunity to reflect on key topics in this lesson. If you can't answer a question, click on it to review the material, but keep in mind you are not expected to memorize or master this knowledge."; Actual: "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."] https://github.com/TheOdinProject/curriculum/blob/main/markdownlint/docs/TOP003.md

- [How do you define a route function in Express?](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/routes#defining_and_using_separate_route_modules)
- [Name four HTTP verbs a route might need to handle.](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/routes#http_verbs)
Expand Down