Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 27, 2022 07:28 am GMT

CRUD Explained

Heyo!!

In this article, I'm going to breakdown everything you need to know about the CRUD functionality, methods and operations you can do on any data stored in an application. Let's get started!

What is CRUD?

  • CRUD stands for Create, Read/Retrieve, Update and Delete which represents the four basic operations you can do on any data stored in an application.
  • You can create something new, read or view the newly created data, edit or update or update the data and finally the option to delete it.
  • CRUD is data-oriented and the standardized use of HTTPS methodsCRUD

CRUD Functions

When working with web services, CRUD corresponds to the HTTPS methods which communicate to a web server how you want to interact with the website or web applications.

Create

  • It means creating an entry. This entry could be an account, user information, a post or a task.
  • When we submit the data using forms, a POST request is sent to our API and data will be stored in the database.
  • The HTTP protocol that implements a CREATE operation is the POST method.

Example
The route for POST request
/appointments/new

Read

  • The read operation means getting access to the inputs of entries in the UI. That is, seeing it.
  • Again, the entry can be anything from user information to media posts, and others.
  • The HTTP protocol that implements a READ operation is the GET method.

Example
The route for GET request
/appointments

Update

  • UPDATE is the operation that allows you to modify existing data. That is, editing the data.
  • PUT and PATCH are the HTTP protocols with which you can implement an update operation, depending on what you need.
  • PUT should be used when you want the entire entry updated, and PATCH if you don't want entire entry modified.

Example
The route for PUT request
/appointments/:id
id in the route specifies which entry in the records needs to be updated.

Delete

  • To delete is to get rid of any data on the UI and the database
  • DELETE is the HTTP protocol for implementing a DELETE operation.
  • To delete any record, each entry has a unique id and the id in the request below identifies the specific record to be removed from the database.

Example
The route for DELETE request
/appointments/:id

That's it!!! #HappyCoding
cheers


Original Link: https://dev.to/mitchiemt11/crud-explained-36pe

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To