Skip to content

Answered questions from readme file and modified app.js file#8

Open
marnel-mangrubang wants to merge 1 commit intopce-uw-jscript400:masterfrom
marnel-mangrubang:master
Open

Answered questions from readme file and modified app.js file#8
marnel-mangrubang wants to merge 1 commit intopce-uw-jscript400:masterfrom
marnel-mangrubang:master

Conversation

@marnel-mangrubang
Copy link

Lesson notes from class and answers to the questions in the readme file

* **Question:** When does `app.use()` get called?

* **Your Answer:**
* **Your Answer:** `app.use()` gets called before the routes since it is before any of our routes.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

* **Question:** What type of thing is `app` and what is its purpose?

* **Your Answer:**
* **Your Answer:** `app` is function with many methods.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct. app is our instance of the server and also an event emitter.

* **Question:** What type of thing is `next` and what does it represent in the callback?

* **Your Answer:**
* **Your Answer:** `next` is the continue action in the callback. It tells our code to continue with the response after the request is made.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

* **Question:** The above can be described as middleware. Describe what middleware is in your own words and how it differs from building a route.

* **Your Answer:**
* **Your Answer:** Middleware is the code that runs before any route is met. Middleware can be used to do run authentication, validation or test.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, although Middleware can also be applied between routes as well as before them.

* **Question:** Try creating a new vegetable. Then, try restarting your server. What happens to the data you posted and why?

* **Your Answer:**
* **Your Answer:** The data that I just created is gone because we did not save it to any database.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

* **Question:** Take a look at the `package.json` file. What is [standardjs](https://standardjs.com/) and what will it do for you?

* **Your Answer:**
* **Your Answer:** `standardjs` is a javascript code auto formatter. It can save my time cleaning out my code and keeping it consistent.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks AirBnB!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants