Skip to content

Shahab w2-espress class notes#12

Open
Shahab13 wants to merge 4 commits intopce-uw-jscript400:masterfrom
Shahab13:master
Open

Shahab w2-espress class notes#12
Shahab13 wants to merge 4 commits intopce-uw-jscript400:masterfrom
Shahab13:master

Conversation

@Shahab13
Copy link

@Shahab13 Shahab13 commented Jul 9, 2019

No description provided.


## Express.js is a node.js framework which makes it easy to work with server side applications and takes care of lots of repetitive things for us.

## morgan provides logging
Copy link

Choose a reason for hiding this comment

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

What is the purpose of body-parser?

* **Your Answer:**

---
## Query parameters are used to make our request more specific. In this case we send them as a key:value pairs.
Copy link

Choose a reason for hiding this comment

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

Query parameters are often used for filters etc.

* **Your Answer:**

---
## app.use() is a general function for every request to go through
Copy link

Choose a reason for hiding this comment

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

Remember each request moves down the list until it finds an endpoint and will only continue if next is called inside a function.

* **Your Answer:**

* **Question:** What type of thing is `app.get()` and what is its purpose?
## The type of 'app' is Object which has multiple function attached to it. node.js starts the Express.js and app is being used to start up our server
Copy link

Choose a reason for hiding this comment

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

App is also function / event emitter.

- **Your Answer:**

* **Question:** What type of thing is `res` and what does it represent in the callback?
## This is the pass represented by '/'.
Copy link

Choose a reason for hiding this comment

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

Path represented, in this case the home.

- **Your Answer:**

## Just need change the 'app.get' to 'app.post'

Copy link

Choose a reason for hiding this comment

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

👍

- **Question:** Right now all of our requests will return a "Status Code" of 200. Define what a status code is and research how you could change it.

- **Your Answer:**

Copy link

Choose a reason for hiding this comment

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

What do Status codes do and why are they important?

- **Question:** Look for `helpers.validate` in the `app.js` file. What is this and how does it work?

* **Your Answer:**
- **Your Answer:**
Copy link

Choose a reason for hiding this comment

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

Gives some middleware functionality. Look how helpers is being used on line 33

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