1.0.1 • Published 2 years ago

fetchu.js v1.0.1

Weekly downloads
-
License
CC-BY-NC-ND-4.0
Repository
github
Last release
2 years ago

fetchu.js

A simple and modern fetch wrapper for Node.js

Installation

npm install fetchu.js

Usage

const { request, RequestMethod } = require('fetchu.js');

request('https://example.com', {
    method: RequestMethod.Get,
    headers: {
        'Content-Type': 'application/json'
    },
    body: {
        foo: 'bar'
    }
}, {
    isOk: (response) => console.log(`API responded successful ${response.status} ${response.statusText}!`),
    isNotOk: (response) => console.log(`API responded unsuccessful ${response.status} ${response.statusText}!`)
});