classwork#15
Open
janauhrich wants to merge 1 commit into
Open
Conversation
MadEste
reviewed
Jul 13, 2019
| * **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. |
MadEste
reviewed
Jul 13, 2019
| * **Question:** When does `app.use()` get called? | ||
|
|
||
| * **Your Answer:** | ||
| * **Your Answer:** whenever a request is made |
There was a problem hiding this comment.
Whenever a request reaches that point of the route chain.
MadEste
reviewed
Jul 13, 2019
| * **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 |
MadEste
reviewed
Jul 13, 2019
| * **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 |
MadEste
reviewed
Jul 13, 2019
|
|
||
| * **Your Answer:** | ||
| * **Your Answer:** status code tells you the health of the relationship with the server | ||
|
|
There was a problem hiding this comment.
To change the status code:
res.status(code)
MadEste
reviewed
Jul 13, 2019
| * **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 |
There was a problem hiding this comment.
Similar to the syntax from react, they are params pulled from inside the path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Still a few questions at the bottom to finish...