CRUD and REST

CRUD is an acronym that refers to the four basic operations related to data storage. Those four operations are Create, Read/Retrieve, Update, and Delete. Each word is self-explanatory:

— Create data and store it in the database
— Read or Retrieve data that’s stored in the database
— Update or change data that’s stored in the database
— Delete data that’s stored in the database

REST or RESTful is a set of guiding principles that create a stable, reliable, and predictable way to conduct data transfers over the internet. REST stands for REpresentational State Transfer. CRUD operations that conform to REST principles will map to RESTful HTTP verbs POST, GET, PUT/PATCH, and DELETE. CRUD operations map to the REST verbs in the following way:

— to Create data you have to POST it
— to Read or Retrieve data you have to GET it
— to Update data you have to PUT or PATCH it
— to Delete data you have to DELETE it

The four HTTP verbs are used to write seven different HTTP requests. GET is used to make 4 different requests and then the other three each make a single request. I’ll use songs in the following example.

— POST a newly created song in the database
— GET a list of all songs in the database
— GET a single song from the database
— GET a form to create a new song
— GET a form to edit an existing song
— PUT or PATCH existing song to change its data
— DELETE existing song from the database

Pairing the HTTP verbs with a path creates seven different requests. Whenever a specific song is targeted, it is retrieved from the database using its unique id.

Using RESTful routes simplifies CRUD operations in the development of applications. REST is a way to make data transfers over the internet and CRUD is a way to maintain data in a database. Mapping the two together in an application results in a great user experience.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Azure Devops pipelines — pass output variable between stages not directly dependent

Part 9: Buy Crypto with Fiat

Single-Host NAT via iptables

SAP Accounts Payable Automation Software: Achieve Faster ROI with Shorter Implementation

Exploring Actions on Google Responses: Basic Card

How to assume an AWS IAM role with MFA

What is Continuous Integration? And Is there an app for that?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Wendy Raven McNair

Wendy Raven McNair

More from Medium

Testing your deployed server and database connection

Designing Great Software — MVC

Dependency Injection Explained

Coding Bootcamp Week 7/13: Final Week on Back-end