request-multiple-demo
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

CircleCI semantic-release semantic-release

request-multiple-demo

Simple library for fetching an array of URLs containing JSON data and returning their contents. It also has supports and optimizes requests by chunking larger arrays.

Install

// Via NPM
$ npm install --save request-multiple-demo

// Via Yarn
$ yarn add request-multiple-demo

Usage

import requestMultipleUrls from "request-multiple-demo";
const urls = [
            'http://example-1.com/data.json',
            'http://example-2.com/data.json',
            'http://example-3.com/data.json',
            'http://example-4.com/data.json',
            'http://example-5.com/data.json',
            'http://example-6.com/data.json',
            'http://example-7.com/data.json',
            'http://example-8.com/data.json',
            'http://example-9.com/data.json',
            'http://example-10.com/data.json',
            'http://example-11.com/data.json',
            'http://example-12.com/data.json'
]


requestMultipleUrls(urls)
.then((data) => {
  console.log(data)
 // { status: 'success', message: [{symbolInput: 'FTSE:FSI', basic: {}, quote: {} }]}
})
.catch((error) => console.error(error))

Documentation

requestMultipleUrls(urls: string[])

Returns a response

urls

Type: string[] - The array of urls.

Example

import requestMultipleUrls from "request-multiple-demo";
const urls = [
            'http://example-1.com/data.json',
            'http://example-2.com/data.json',
            'http://example-3.com/data.json',
]

requestMultipleUrls(urls)
.then((data) => {
  console.log(data)
 // { status: 'success', message: [{symbolInput: 'FTSE:FSI', basic: {}, quote: {} }]}
})
.catch((error) => console.error(error))

Local Development

On your terminal console,

  • Clone this repo

  • cd request-multiple-demo

  • Install dependencies yarn install

Testing

Tests are located in the tests folder an can be invoked by running yarn test.

Semantic release

Release management is automated using semantic-release.

License

The MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i request-multiple-demo

Weekly Downloads

2

Version

1.0.3

License

MIT

Unpacked Size

10.5 kB

Total Files

17

Last publish

Collaborators

  • s-barrah