1.0.1 • Published 2 years ago

@cnev/request-multiple-urls v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Documentation for request multiple URLs package:

  • This is a JS package that implements a function to fetch data from an array of URLs and returns the json returned as a promise.

Structure: -> requestMultipleUrls: directory containing project -> test: directory containing jest unit tests -> reqMulUrl.test.js: unit tests for function getMultipleURLS(urls[]) -> package.json: describes package contents and function -> readme.md: this file -> requestMultipleUrls.js: file containing the function that fetches urls and bundles as Promise -> test.js: file that calls the exported requestMultipleUrls.js with relevant url data

Error states: Error states are considered in the main function in requestMultipleUrls.js. If an error is caught with the request is made it is logged to the console. Other error states are caught by the unit tests such as ensuring a promise is returned.

Testing: Unit tests are coupled with the package and test various requirements for the function and it's potential errors

Documentation: Documentation is this readme file. Useage: run npm install '@cnev/request-multiple-urls' use const var_name = require('request-multiple-urls') at the top of your code. use var_name.requestMultipleUrls(urls) where urls is an array of urls to be fetched.

Choice of dependencies: This project was going to depend on the 'node-fetch' module which is a lightweight module that enables us to use the fetch() function in NodeJS. Thankfully as I was writing this is noticed that Node.js v17.5 introduced support for fetch() so we can get away with no dependencies!