reading-notes

Reading 12 - CRUD

Source: Moesif

Q1 In your own words, describe what each group of status code represents:

Q2 What is a status code 202?

Accepted. Used for async, this means the request was successful so far, but the response will finish in the future.

Q3 What is a status code 308?

Permanent redirect. Another URL is needed to access the resource.

Q4 What code would you use if an update didn’t return data to a client?

204 - No Content

Q5 What code would you use if a resource used to exist but no longer does?

410 - Gone

Q6 What is the ‘Forbidden’ status code?

403 - This means the client doesn’t have the required permissions

Source: Web Dev Simplified

Q7 Why do we need to pull our MongoDB database string out of our server and put it into our .env?

Because it is sensitive information that should be kept hidden

Q8 What is middleware?

Code that runs when the server gets a request, but before it gets passed to routes

Q9 What does app.use(express.json()) do?

Lets the server accept json as a body

Q10 What does the /:id mean in a route?

The / means the root, the : signifies a parameter, and id means one

Q11 What is the difference between PUT and PATCH?

Patch updates just the information that is passed Put updates all

Q12 How do you make a default value in a schema?

Add a key-value pair where the key is “defaut” and the value is whatever the default value should be. For example, default: Date.now

Q13 What does a 500 error status code mean?

A 500 error means the the error was on the server end, not the user end.

Q14 What is the difference between a status 200 and a status 201?

200 is default success message, means everything is successful. 201 means successfully created an object, more specific

Things I want to know more about

Of the things that we’ve been using, which things come from express and are not native to vanilla javascript?