fetch-json-data

1.0.5 • Public • Published

fetch-json-data

Node library for getting JSON document

Install

npm install --save fetch-json-data

Usage

const getData=require('fetch-json-data')


// promise
let dataObj;
let url = http() + ip + '/getData', method = 'post';
getData(url, method)
.then(function (result) {
    console.dir(result);
    dataObj = result;
})
.catch(function(error){
    console.log(error);
});


// async/await
(async function(){
    let dataObj;
    let url = http() + ip + '/getData', method = 'post';
    try{
        const result = await getData(url, method);
        dataObj = result;
    } catch (error) {
        console.log(error);
    }
})();

Readme

Keywords

Package Sidebar

Install

npm i fetch-json-data

Weekly Downloads

1

Version

1.0.5

License

ISC

Unpacked Size

1.72 kB

Total Files

3

Last publish

Collaborators

  • nguyennguyen