A simple promisse based and single file wrapper for new comers start to use Fetch API.
Just import the Request.js file.
Or install with npm:
npm i @schirrel/request
Request.get("https://jsonplaceholder.typicode.com/todos/1") .then((res) => { }) .catch((err) => { });
Request.post('https://jsonplaceholder.typipre.com/posts', { body: { title:'Ahoy' } }) .then((res) => { }) .catch((err) => { });
Request.put('https://jsonplaceholder.typicode.com/posts/1', { body: { id:1, title:'Ahoy' } }) .then((res) => { }) .catch((err) => { });
Request.delete('https://jsonplaceholder.typicode.com/posts/1') .then((res) => { }) .catch((err) => { });
If it helps you, gives Alan a hi!