Wondering what’s next for npm?Check out our public roadmap! »

    @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>;

    Keywords

    Install

    npm i @idan-loo/request-json

    DownloadsWeekly Downloads

    3

    Version

    1.0.1

    License

    ISC

    Last publish

    Collaborators

    • avatar