ft-request-multiple-urls
v1.0.7
Published
A JavaScript Package that fetches an array of URLs which and returns JSON data using promises
Downloads
16
Readme
ft-request-multiple-urls
A JavaScript package that is able to
● fetch an array of URLs which contain JSON data
● return their contents in a promise
Install
Run the the below command in the terminal
npm install ft-request-multiple-urls
Example Usage
const requestMultipleUrls = require('ft-request-multiple-urls')
const urls = [
'https://ft-tech-test-example.s3-eu-west-1.amazonaws.com/ftse-fsi.json',
'https://ft-tech-test-example.s3-eu-west-1.amazonaws.com/gbp-hkd.json',
'https://ft-tech-test-example.s3-eu-west-1.amazonaws.com/gbp-usd.json'
]
const getData = () => {
const data = requestMultipleUrls(urls)
.then(data => console.log(data))
.catch(error => console.error(error))
}
getData()
Dependencies
node-fetch
node-fetch makes use of minimal code for a window.fetch compatible API on Node.js runtime. It uses native Node streams for body, on both request and response. Also, it uses native promise, but allow substituting it with [insert your favorite promise library].
