npm.io
1.3.0 • Published 4 years ago

@schirrel/request

Licence
MIT
Version
1.3.0
Deps
0
Size
10 kB
Vulns
0
Weekly
0
Stars
1

Request

A simple promise based and single file wrapper for newers to start using Fetch API.

For those who dont want a big library to simple requests, and yet want to simplify the fetch use.

npm version

Installing

Just import the Request.js file or run npm i @schirrel/request.

Examples

See Example Folder

GET
Request.get("https://jsonplaceholder.typicode.com/todos/1")
.then((res) => {})
.catch((err) => {});
POST
Request.post('https://jsonplaceholder.typipre.com/posts', {
    body: {
        title:'Ahoy'
    }
})
.then((res) => {})
.catch((err) => {});
PUT
Request.put('https://jsonplaceholder.typicode.com/posts/1', {
body: {
   id:1,
   title:'Ahoy'
    }
 })
.then((res) => {})
.catch((err) => {});
DELETE
Request.delete('https://jsonplaceholder.typicode.com/posts/1')
.then((res) => {})
.catch((err) => {});

For a http client you can also check api-request current under development

Keywords