Skip to content

Tom Workman | w2-express assignment#9

Open
tworkman512 wants to merge 10 commits intopce-uw-jscript400:masterfrom
tworkman512:master
Open

Tom Workman | w2-express assignment#9
tworkman512 wants to merge 10 commits intopce-uw-jscript400:masterfrom
tworkman512:master

Conversation

@tworkman512
Copy link

Completed questions for the w2-express assignment.

* **Question:** What are headers? What values do you recognize?

* **Your Answer:**
* **Your Answer:** Expresss is powering it, the `Content-Type` looks familiar, and the `Date` information.
Copy link

Choose a reason for hiding this comment

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

Returns metadata, usually info about the server and the response.

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

* **Your Answer:**
* **Your Answer:** `app.use()` is a general function for every request to go through and is called when it finds a match for a specified path.
Copy link

Choose a reason for hiding this comment

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

Remember app.use will always be called if a request has reached that point of the route chain.

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

* **Your Answer:**
* **Your Answer:** `app` is a middleware function. It's job is to parse incoming requests with JSON payloads and has many different methods on it, one of which is `.get()`.
Copy link

Choose a reason for hiding this comment

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

In this case app is the instance of our server itself.

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

* **Your Answer:**
- **Your Answer:** My data did not persist. This happened because as of now, it's just using the HTTP `POST` method to send data to a route and we are not using a database or a JSON file to store the contents that are being created.
Copy link

Choose a reason for hiding this comment

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

Correct, the data is being stored as an object which does not persist once the server is restarted.

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