301 Class Twelve Reading Notes “CRUD”
Questions
In your own words, describe what each group of status code represents:
- 100’s = informational status codes about the header
- 200’s = success codes
- 300’s = redirection codes resource not at first address
- 400’s = client error codes
- 500’s = server error codes
- What is a status code 202? create action accepted
- What is a status code 308? Perminent redirect
- What code would you use if an update didn’t return data to a client? 204
- What code would you use if a resource used to exist but no longer does? 410
- What is the ‘Forbidden’ status code? client has authorized or doesn’t need to authorize itself, but still has no permissions to access the resource
- Why do we need to pull our MongoDB database string out of our server and put it into our .env? because it has sensitive information we dont want to share and its not on local host
- What is middleware? software that provides common services and capabilities to applications outside of what’s offered by the operating system.
- What does app.use(express.json()) do? lets our server accept json as a body
- What does the /:id mean in a route? it means it is a parameter
- What is the difference between PUT and PATCH? PUT is a technique of altering resources when the client transmits data that revamps the whole resource. PATCH is a technique for transforming the resources when the client transmits partial data that will be updated without changing the whole data
- How do you make a default value in a schema? set the default value. category: { type: String, default: ‘’ }.
- What does a 500 error status code mean? it a server error code
- What is the difference between a status 200 and a status 201? 200 means that the request was received, understood, and is being processed, whereas the 201 status code indicates that a request was successful and a resource was created as a result.