get-fetch-json
v1.0.4
Published
Fetch a url and get a json format as a response
Downloads
6
Readme
Usage
npm i get-fetch-json
Without await
const { fetch_Json } = require('get-fetch-json');
fetch_Json('URL HERE', {
method: 'METHOD HERE', // Will defult to 'GET'
headers: {
// Header here
},
body: {
// Body here
// Will always be set to JSON format
}
}).then(response => {
console.log(response)
})
With await
const { fetch_Json } = require('get-fetch-json');
async function TestFunction() {
const res = await fetch_Json('URL HERE', {
method: 'METHOD HERE', // Will defult to 'GET'
headers: {
// Header here
},
body: {
// Body here
// Will always be set to JSON format
}
})
console.log(res)
};
TestFunction()