HTTP DELETE

DELETE is an important operation of CRUD functionality. We can easily perform delete operations using the HTTP DELETE method. The delete operation can be achieved depending on the use case and the application's compliance. There are two types of deletions we can do—soft delete and hard delete:

  • Soft delete: When using soft delete, we do not delete or erase the records from our database systems; instead, we update the records and set a column or field and mark it as deleted so that the records are not displayed to the user. 
  • Hard delete: The requested data is deleted permanently from the database system. Once the data is erased, it cannot be reverted or restored.

Let me give you a good example of both use cases. If you try to delete your Google account, it notifies you that you can come back and restore your account within x number of days, after which the data will be completely erased from their servers.

Back to our implementation. We can use the http.delete() method to implement the DELETE functionality in our applications. The sample code is given here:

this.http.delete(url, options);

We need to pass the URL value as mandatory and options, as the name implies, are optional for the delete method.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.114.85