Skip to content

Tom Workman | w2-express assignment#9

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

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

Conversation

@tworkman512
Copy link
Copy Markdown

Completed questions for the w2-express assignment.

Comment thread readme.md
* **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
Copy Markdown

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.

Comment thread readme.md
* **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
Copy Markdown

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.

Comment thread readme.md
* **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
Copy Markdown

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.

Comment thread readme.md
- **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
Copy Markdown

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