Introduction

๐Ÿ”ฅwarning

WIP Package!

Promise based HTTP request API


GitHub Licensenpm versionnpm minified sizenpm total downloads

โ“ api#

The api package is a Promise based HTTP/s request API, with a simple syntax.

โฐ Short Example#

// Let't create our API
const api = new API({
baseURL: 'https://myapp.com', // Base Route to the Host
timeout: 10000, // After which amount of time a request times out
options: { credentials: 'include' } // Http/s Request Options from type RequestInit
});
// Now we can create our first Request to 'https://myapp.com/hello'
const response = await api.get('/hello');
console.log(response);
/*
{
data: {hello: "Jeff"}; // Response Data
timedout: false; // If Request has timedout
status: 200; // Response Status Code
raw: Response; // Raw Response from type Response
type: "application/json"; // Response Type
}
*/
Last updated on