1.1.2 • Published 3 years ago

simple-api-wrapper v1.1.2

Weekly downloads
4
License
ISC
Repository
github
Last release
3 years ago

Intro

This is a super simple API Wrapper for making calls to different API endpoint with GET request.

Installation

npm i simple-api-wrapper --save

Usage

const wrapper = require("./app");

//endpoints and data
const config = {
        get: [
                {
                    "https://jsonplaceholder.typicode.com/posts": {}, 
                    "https://jsonplaceholder.typicode.com/posts/1": {},
                }
            ],
        };

const allResponse = wrapper.apiWrapper(config);
allResponse.then(result => console.log(result));

Options

The config argument is REQUIRED but below are the available configs

const config = {
    method: [
        {
            url_1: {...data_1}, 
            url_2: {...data_2},
            ...
            url_n: {...data_n},
        }
    ]
};

method: "get" - specifies http method for api request url: "http://some-api-host/endpoint" - specifies url string of different API endpoint data: {key: "value",} - specifies key-value pair of object/data to be sent to different API endpoint

1.1.2

3 years ago

1.0.0

3 years ago