You can fetch datausing any methods you know ie fetch, axios etc. The api gives json data containing furnitures. You can use it in your projects and enjoy it
fetch("https://fakeecommerceapi.onrender.com/api/v1/products")
.then((res) => res.json())
.then((json) => console.log(json));
fetch("https://fakeecommerceapi.onrender.com/api/v1/products/:id")
.then((res) => res.json())
.then((json) => console.log(json));
fetch("https://fakeecommerceapi.onrender.com/api/v1/products/:id", {
method: "POST",
body: JSON.stringify({
name: "new product",
price: 10,
description: "product desription",
image: "img url",
category: "electronics",
}),
})
.then((res) => res.json())
.then((json) => console.log(json));
/* response
{
"price": 25,
"name": "accent chair",
"image": "img url",
"description": "Comfy chair for you living room",
"category": "electronics",
}
*/
fetch("https://fakeecommerceapi.onrender.com/api/v1/products/:id", {
method: "DELETE",
});
/*
the response
{
"price": 25,
"name": "accent chair",
"image": "img url",
"description": "deleted product description",
"category": "home"
}
*/
fetch("https://fakeecommerceapi.onrender.com/api/v1/products/:id", {
method: "PUT",
body: JSON.stringify({
title: "updated product",
price: 30,
description: "updated product description",
image: "img url",
category: "electronics",
}),
})
.then((res) => res.json())
.then((json) => console.log(json));
/* response
{
"price": 30,
"name": "updated product",
"image": "img url",
"description": "updated product description",
"category": "electrinics",
}
Note: The update will not occur on the database
*/
//request body
{
price: Number,
name:String,
image: String,
description: String,
category: String
}
GET
/products (get all products)
/products/:id (get a single product)
/products/category/home (sort products using category)
POST
/products
PUT
/products/:id
DELETE
/products/:id
currently un available
{
id:Number,
full_name: String,
email: String,
password: String,
telephone: Number,
}
GET
/user (get all users) /user/:id (get a single user)
POST
/user
DELETE
/user/:id (remove a user)
PATCH
/user/:id (update a user)
//login fields
{
email: String;
password: String;
}
POST
/auth/login
//sign in fields
{
full_name: String,
email: String,
password: String,
telephone: Number,
}
/auth/signup
Enjoy and feel free to contribute.