(FYI: I'm a junior software dev looking for a job in the US. email)
fetch wrapper but it's modular.
easier to comprehend.
- Install cute-fetch locally.
npm install cute-fetch
import fch from 'cute-fetch';
// body can be string or any js object
const response = await fch('https://api.example.com/users').POST("any");
const response = await fch('https://api.example.com/users/1').PUT({
name: 'John Doe',
email: 'john@example.com',
}); // or string
// await fch('https://api.example.com/data').SOFTWRITE('string')
const response = await fch('https://api.example.com/data').SOFTWRITE({
key: 'value',
});
// await fch('https://api.example.com/data').OVERWRITE('string')
const response = await fch('https://api.example.com/data').OVERWRITE({
key: 'newValue',
});
const response = await fch('https://api.example.com/users/1').DELETE();
const response = await fch('https://api.example.com/users').GET();
const data = await response.json();
console.log(data);