@fjp-npm/request-multiple-urls v1.0.2
@fjp-npm/request-multiple-urls
request-multiple-urls is a JavaScript package to fetch JSON data from a collection of url endpoints.
Installation
npm install @fjp-npm/request-multiple-urlsUsage
const requestMultipleUrls = require('@fjp-npm/request-multiple-urls');
const urls = [
'https://google.com',
'https://jsonplaceholder.typicode.com/todos/10',
'https://ft-tech-test-example.s3-eu-west-1.amazonaws.com/ftse-fsi.json'
];
requestMultipleUrls(urls).then(urlContent => {
console.log(urlContent);
});The requestMultipleUrls function returns an array of objects where each object represents the JSON returned
from one endpoint. If an endpoint does not return valid JSON then nothing is added to the response array for that
particular url and a debug message is written to the console.
Type information is included for TypeScript support.
Contributing
The project is not looking for contributors at this time.
License
Developer notes
Requirements
The project requires node and npm that are available from Node.js
and the project has been tested with node version 12.18.1 and npm version 6.14.5.
Installation
The project is available on GitHub so can be cloned with the command:
git clone https://github.com/fjp-npm/request-multiple-urls.gitProject dependencies can be installed with the command:
npm installAxios is the only direct runtime dependency. It was selected as the Promise based HTTP client because it is very popular and actively supported. It is also has a comprehensive range of features including support for TypeScript.
Build
To compile the TypeScript project use:
npm run buildTo run compiler with file watching use:
npm run tscLinting
To trigger linting (ESLint) use:
npm run lintTo trigger linting (ESLint) and fix issues use:
npm run fixTests
Unit tests have been implemented with Jest and can be run with the command:
npm run testTo run tests with file watching use:
npm run tddDocumentation
The project uses TypeDoc to generate documentation.
The documentation can be found in the docs folder and is generated by the command:
npm run docsPublishing
Standard scripts to support npm publishing are also included i.e. prepare, prepublishOnly,version,preversion and postversion