Skip to content

classwork#15

Open
janauhrich wants to merge 1 commit into
pce-uw-jscript400:masterfrom
janauhrich:master
Open

classwork#15
janauhrich wants to merge 1 commit into
pce-uw-jscript400:masterfrom
janauhrich:master

Conversation

@janauhrich
Copy link
Copy Markdown

Still a few questions at the bottom to finish...

Comment thread readme.md
* **Question:** What are headers? What values do you recognize?

* **Your Answer:**
* **Your Answer:** Headers are the metadata that the server sends with a every response. Content type is the json we've returned and it's encoding, x-powered by expresss describes the framework we're using.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread readme.md
* **Question:** When does `app.use()` get called?

* **Your Answer:**
* **Your Answer:** whenever a request is made
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Whenever a request reaches that point of the route chain.

Comment thread readme.md
* **Question:** What type of thing is `next` and what does it represent in the callback?

* **Your Answer:**
* **Your Answer:** next is a method and tells the code to continue executing next available matching route
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread readme.md
* **Question:** Instead of a `GET` request, lets say we want to listen in for a `POST` request. What do you think you needs to change?

* **Your Answer:**
* **Your Answer:** post will create something on the server. just change get -> post
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

app.post(...

Comment thread readme.md

* **Your Answer:**
* **Your Answer:** status code tells you the health of the relationship with the server

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

To change the status code:
res.status(code)

Comment thread readme.md
* **Question:** What is `req.params`? What else will you need to change if you change the path to `/my/name/is/:username`?

* **Your Answer:**
* **Your Answer:** route parameters, different than query params, they are defined inside
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Similar to the syntax from react, they are params pulled from inside the path.

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