Open
Conversation
MadEste
reviewed
Jul 13, 2019
| * **Question:** What are query parameters? Try going to a couple of your favorite websites and paste an example of query parameters being used. | ||
|
|
||
| * **Your Answer:** | ||
| * **Your Answer:anything after ? you have a key value pair. for about course is the key and javascript is the value |
There was a problem hiding this comment.
Passes these additional parameters in the url after the route. Useful for filters etc.
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: it is from the client telling the server to create, update or delete an object |
There was a problem hiding this comment.
as far as code goes, we need to use
app.post
MadEste
reviewed
Jul 13, 2019
| * **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:** | ||
| * **Your Answer:satus code indicate the success or failure of a request or return status - 200 is success, there are several like not found, or unauthorized, they let the client know why or where a request failed or was successful or redirected. Add a.status method |
MadEste
reviewed
Jul 13, 2019
| * **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 can be the gate that params go through that screen for access or redirect as needed |
There was a problem hiding this comment.
Middleware is the code/application/module that communicates between two systems, such as between servers and databases. The code above is different than a route because it is always run whenever the application gets to these lines.
MadEste
reviewed
Jul 13, 2019
| * **Question:** Describe the purpose of both morgan and body-parser. Why do you think morgan is only being run when the application is run in development mode? | ||
|
|
||
| * **Your Answer:** | ||
| * **Your Answer:Morgan is a request logger, body-parser parses your request and converts it into a format from which you can easily extract relevant information that you may need |
MadEste
reviewed
Jul 13, 2019
| * **Question:** Try commenting out `body-parser` in your application. What happens and why? | ||
|
|
||
| * **Your Answer:** | ||
| * **Your Answer: I must have done somethign wrong, I did not see any changes |
There was a problem hiding this comment.
If commented out you should loose access to req.body and therefore cannot send a proper response.
MadEste
reviewed
Jul 13, 2019
| * **Question:** Take a look at the last two `app.use()` methods at the end of the file. Describe how both work and what `err` is refers to. | ||
|
|
||
| * **Your Answer:** | ||
| * **Your Answer:The first sets a not found (404) message if the inputed request cannot be found, the second is the response to the request |
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.
No description provided.