Reading 12
HTTP Codes
100 = Informational status codes, header received 200 = Success Codes, request was accepted 300 = Redirection Codes, request not available at server location 400 = Client Error Codes, invalid request was sent 500 = Server Error Codes, server performance usually deprecated
What is a status code 202?
Accepted. This will let the client know that the request is working, but it has not completed processing
What is a status code 308?
Permanent Redirect. This lets the client know that the URL they are accessing is no longer valid and points them to a new one.
What code would you use if an update didn’t return data to a client?
204 No Content
What code would you use if a resource used to exist but no longer does?
308 Permanent Redirect
What is the ‘Forbidden’ status code?
403
Why do we need to pull our MongoDB database string out of our server and put it into our .env?
Otherwise, the information would be shared or open to the public and it contains sensitive information
What is middleware?
This is software that lives between an OS and programs running on it.
What does app.use(express.json()) do?
The incoming Request Object will be known to the application as a JSON Object
What does the /:id mean in a route?
Anything that we pass after the ‘/’ in the route will be a parameter.
What is the difference beween PUT and PATCH?
The PUT method uses the request URI to update the requested resource. The PATCH method provides instructions to modify a resource.
How do you make a defalut value in a schema?
const schema = new Schema({
value1: String,
value2: { type: String, default: 'instructor' }
});
What does a 500 error status code mean?
Internal Server Error
What is the difference between a status 200 and a status 201?
200: request was received and understood and is being processed 201: request was successful, has response, and a resource has been created