Cheat Sheet CURD Fetch API

Tosh
2 min readMar 20, 2021

CRUD Operation?

The acronym CRUD stands for Create, Read, Update and Delete.

Create: Inserts a new data
Read: Read the data
Update: Update the existing data
Delete: Delete the existing data

List of HTTP Request methods

GET — is used to request data from a specified resource.
POST — is used to send data to a server to create a resource.
PUT — is used to send data to a server to update a resource.
DELETE — is used to delete the specified resource.

REST API Server ?

If you’re performing CRUD operation using Fetch API you’re going to need a REST API server.

JSONPlaceholder is a free online REST API that you can use whenever you need some fake data. It’s great for learning, tutorials, testing new libraries, sharing code-examples.

Fetch API

GET Posts

urlhttps://jsonplaceholder.typicode.com/posts

Console

CREATE a Post

urlhttps://jsonplaceholder.typicode.com/posts
methods — POST

UPDATE a Post

urlhttps://jsonplaceholder.typicode.com/posts
methods — PUT

DELETE a Post

urlhttps://jsonplaceholder.typicode.com/posts/0
0 is a post id, so we are going to delete a post where the id = 0
methods - DELETE

--

--