Reading-Notes

View the Project on GitHub MohammadAl-khatib/Reading-Notes

CRUD

Status Codes Based On REST Methods

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

    • 100’s = informational status codes.

    • 200’s = request accepted, done successfully

    • 300’s = request redirected

    • 400’s = errors in request, like URL errors or missng queries.

    • 500’s = internal server errors.

  2. What is a status code 202? request accepted and is under processing.

  3. What is a status code 308? the current URL is not valid for request any more, redirected to another URL.

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

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

  6. What is the ‘Forbidden’ status code? no permission to access the resource.

Build A REST API With Node.js, Express, & MongoDB - Quick

  1. Why do we need to pull our MongoDB database string out of our server and put it into our .env? for none local host uses.

  2. What is middleware? a code that runs once the server gets request.

  3. What does app.use(express.json()) do? lets the server accept JSON elements.

  4. What does the /:id mean in a route? a parameter that can be accessed using req.params.id

  5. What is the difference beween PUT and PATCH? PUT updates all the information while PAtch updates some.

  6. How do you make a defalut value in a schema? using default: value inside the property in need.