DEV Community

Tri Nguyen
Tri Nguyen

Posted on

Understand basic REST Methods

What is up fellow coder.

Thank you for checking out my article on Understanding REST methods and its correlation with EXPRESS server.

Lets get right into it!

What is REST Method ?

Well it stands for Representational State Transfer.......

Ok, since this article is about REST methods associated with Express Router and Node.js. REST is the different HTTP routes that can define the relationship/interaction between the client/server for our applications.

And these methods can be used to map out CRUD (create, retrieve, update, delete) operations. An example of CRUD application can be Facebook, because you can create content, retrieve content, update content, and delete content.

Big Picture: when building a CRUD application you will need your
Web page(html,CSS, and JavaScript), a database to get and store data, and a Server to configure the application and create routes between clients and database. Essentially you can imagine using REST methods is used as a way for the server to respond to what the client wants to do and apply the changes to the database.

Lets Apply

Lets take a look at some of the main REST methods and their correlation with a CRUD application.

  1. GET - this method retrieves information, a GET request can be made by a client or server to get information from a database. (The retrieve part of CRUD)

  2. POST - this request is often used to create a new entity. Clients post new content, which in turn the content will either create new data or update data in the database. (the create part of CRUD)

  3. PUT - Store an entity at a URI. PUT can update an existing entity. A PUT request is idempotent, meaning clients can make that same call repeatedly while producing the same result. (the 'update' part of CRUD)

  4. DELETE - Request that a resource be removed. If a client removes a content, the database will remove that content from the database. (the 'delete' part of CRUD)

Oldest comments (0)