@idan-loo/request-json
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Request JSON

Intro

A http request library for Restful API. All the responses will be parsed as json objects.

Install

npm install --save @idan-loo/request-json

Example

import request from '@idan-loo/request-json';

request.get('./test.json', {name: 'tom'})
    .then(result => /* do something with result */);

Notice

You should give a fetch function in most case.

import request from '@idan-loo/request-json';
import fetch from 'isomorphic-fetch';

request.setFetch(fetch);

request.get(/* do something */);

API

get(uri: string, query?: Object): Promise<any>;
post(uri: string, body: any): Promise<any>;
put(uri: string, body: any): Promise<any>;
delete(uri: string, query?: any): Promise<any>;

Readme

Keywords

Package Sidebar

Install

npm i @idan-loo/request-json

Weekly Downloads

3

Version

1.0.1

License

ISC

Last publish

Collaborators

  • idan-loo