DEV Community

Code_Regina
Code_Regina

Posted on • Edited on

|RESTful| RESTful: Routes

          -Get vs. Post Request 
          -Intro to REST
          -RESTful Comments Overview
Enter fullscreen mode Exit fullscreen mode

Get vs. Post Request

GET vs. POST

Get is used to retrieve information, data is sent via query string, information is plainly visible in the URL, and limited amount of data can be sent.

POST is used to post data to the server, to write, create, and update. Data is sent via request body, not a query string. Can send any sort of data (JSON).

Intro to REST

REST stands for representational state transfer. REST is a set of guidelines for how a client/sever should communicate and perform CRUD operations on a given resource.

The main idea of REST is treating data on the server side as resources than be CRUDed.

The most common way of approaching REST is in formatting the URLs and HTTP verbs in your applications.

CRUD = Create, Read, Update and Delete

RESTful Comments Overview

This is the pattern of REST


GET /comments - list all comments 
POST /comments - Create a new comment 
GET /comments/:id - Get one comment (using ID)
Patch /comments/:id - Update one comment 
Delete /comments/:id - Destroy one comment 

Enter fullscreen mode Exit fullscreen mode

Alt Text

Top comments (1)

Collapse
 
jonrandy profile image
Jon Randy 🎖️

Your notes contradict themselves with regards to the HTTP verbs