/GetAndPostRequest

I learned how to make a get and post request on MongoDB database.

Primary LanguageJavaScript

GetAndPostRequest

I learned how to make a get and post request on MongoDB database.

There are 5 main types of HTTP requests

  1. GET: GET request is used to read/retrieve data from a web server. GET returns an HTTP status code of 200 (OK) if the data is successfully retrieved from the server.
  2. POST: POST request is used to send data (file, form data, etc.) to the server. On successful creation, it returns an HTTP status code of 201.
  3. PUT: A PUT request is used to modify the data on the server. It replaces the entire content at a particular location with data that is passed in the body payload. If there are no resources that match the request, it will generate one.
  4. PATCH: PATCH is similar to PUT request, but the only difference is, it modifies a part of the data. It will only replace the content that you want to update.
  5. DELETE: A DELETE request is used to delete the data on the server at a specified location.