Skip to content

Completed#13

Open
Jeremyjdz13 wants to merge 1 commit intopce-uw-jscript400:masterfrom
Jeremyjdz13:master
Open

Completed#13
Jeremyjdz13 wants to merge 1 commit intopce-uw-jscript400:masterfrom
Jeremyjdz13:master

Conversation

@Jeremyjdz13
Copy link

No description provided.

* **Your Answer:**

---
* When a get request is running. It appears to be called before all other functions. Top down.
Copy link

Choose a reason for hiding this comment

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

👍

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

* **Your Answer:**
* app is our application referenced in the app.js and shown in browser via index.js.
Copy link

Choose a reason for hiding this comment

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

our instance of the server. also a function / event emitter

* **Question:** What type of thing is `req` and what does it represent in the callback?

* **Your Answer:**
* It is looking for a request.
Copy link

Choose a reason for hiding this comment

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

specifically the request object

* **Question:** What type of thing is `next` and what does it represent in the callback?

* **Your Answer:**
* If after running the first get() move to the next get() function.
Copy link

Choose a reason for hiding this comment

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

Continues to forward the request to the next matching route.

* **Your Answer:**

---
* req.params is the request parameter :name. If you change thet get request parameter to :username you have to change the the response message to reflect the name of the parameter to ${req.params.username}.
Copy link

Choose a reason for hiding this comment

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

👍

* **Your Answer:**

---
* The middleware will run before a route.
Copy link

Choose a reason for hiding this comment

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

Sometimes, depends on where it is defined in the route chain.
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.

* **Your Answer:**

---
* If morgan is signed in he or she will have dev environment variable. The body-parser appears to set the environment variable to json(). Meaning it's parsing all data to json.
Copy link

Choose a reason for hiding this comment

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

Morgan provides logs which are not very useful outside of development.

without body-parser we would lose access to req.body

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

* **Your Answer:**
I was having issues with getting anything to post to state. But considering that it was a state if you refresh the server I would assume state would be saved.
Copy link

Choose a reason for hiding this comment

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

Since we never saved the data to a file or database it exists only as a javascript object which is lost when the server restarts.


* **Your Answer:**

* These are the formating standards for writing code so developers across the galaxy will understand and be able to read your code easier and faster.
Copy link

Choose a reason for hiding this comment

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

👍

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