Fetch all soups (GET) fetch('https://cloud-app.soupabase.workers.dev/soup')
.then(res => res.json())
.then(json => console.log(json))
Get response
Fetch all soups with a limit parameter (GET) fetch('https://cloud-app.soupabase.workers.dev/soup?limit=2')
.then(res => res.json())
.then(json => console.log(json))
Get response
Fetch soup by Id (GET) fetch('https://cloud-app.soupabase.workers.dev/soup/1')
.then(res => res.json())
.then(json => console.log(json))
Get response
Create a Soup (POST) fetch('https://cloud-app.soupabase.workers.dev/soup', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: "Chocolate Soup",
ingredients: ["Chocolate", "Milk", "Sugar"],
price: 2.50,
hot: true,
description: "Chocolate soup is a made up soup for children",
imgUrl: "www.newsoupbucket.com/chocolatesoup",
origin: {year: 2024, by: "Samantha Suleke", source: "Gains & Gains"},
category: "vegetarian",
})
})
.then(res => res.json())
.then(json => console.log(json))
Get Response
Update a Soup (PATCH) fetch('https://cloud-app.soupabase.workers.dev/soup/1', {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
"id": "1",
"name": "Tomato Soup",
"price": 2.5,
"ingredients": ["Tomatoes","Salt","Pepper"],
"hot": true,
"description": "A delicious tomato soup.",
"imgUrl": "http://example.com/tomato-soup.jpg",
"origin": {"year":1857,"by":"Eliza Leslie","source":"New Cookery Book"},
"category": "vegan",
"nullValue": null
})
})
.then(res => res.json())
.then(json => console.log(json))
Get Response
Update a Soup (PUT) fetch('https://cloud-app.soupabase.workers.dev/soup/1', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
"id": "1",
"name": "Tomato Soup",
"price": 2.5,
"ingredients": ["Tomatoes","Salt","Pepper"],
"hot": true,
"description": "A delicious tomato soup.",
"imgUrl": "http://example.com/tomato-soup.jpg",
"origin": {"year":1857,"by":"Eliza Leslie","source":"New Cookery Book"},
"category": "vegan",
"nullValue": null
})
})
.then(res => res.json())
.then(json => console.log(json))
Get Response
Delete a Soup (DELETE) fetch('https://cloud-app.soupabase.workers.dev/soup/1', {
method: 'DELETE',
})
.then(res => res.json())
.then(json => console.log(json))
Get response