reading-notes

reading notes for code fellows


Project maintained by dLeigh01 Hosted on GitHub Pages — Theme by mattgraham

CRUD

It is important to learn the different status codes so you know what to send/ what ones you are being sent mean and also its good to go again over linking up with a database to be sure you’ve got it clear.

Status Codes Based on REST Methods

An HTTP status code is a number between 100 and 600 that is part of an HTTP response. The first digit denotes the class of the response and it comes with a reason phrase.

Status classes:

CRUD (create, read, update, delete) is a model defining the most basic API actions for persistant storage.

Errors are another important section of status codes

  1. 100s, the server is acknowledging your request - 200s, the server has accepted your request - 300s, the server needs you to go somewhere else - 400s, the client has messed something up - 500s, the server has messed something up.
  2. 202 is Accepted
  3. 308 is a permanent redirect
  4. If an update didn’t return data, you would return 204.
  5. If a resource used to exist, but no longer does you would use 410.
  6. Forbidden is 403

Build a Rest API

  1. Because we don’t want the database link pushed to github.
  2. Middleware runs between when the server recieves a request and passes it to a route.
  3. Lets the server accept json as a body.
  4. It is a parameter.
  5. Patch only updates based on what is passed in, while Put updates everything.
  6. You put in a default key in the object.
  7. 500 meanse there’s an error on the server.
  8. 201 meanse successfully created an object, 200 is a more generic success.

Things I Want to Know More About

[< table of contents]

[< home]