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!
- 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 methods
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.
- 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.
The route for POST request
- 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.
The route for GET request
- 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.
The route for PUT request
id in the route specifies which entry in the records needs to be updated.
- 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.
The route for DELETE request