1.0.0 • Published 3 years ago

ft-multiple-urls v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
3 years ago

JavaScript package that is able to:

  • fetch an array of URLs which contain JSON data
  • return their contents in a promise.

Testing

run yarn test to execute the tests which cover valid and invalid cases. If I were to spend more time, I would have mocked axios.

Documentation

Added some comments to explain what is the main purpose of each function. The main index.js holds only the basic interface and delegates the api and parsing of the response to request.js

Error states

If the api returns any other response other than 200, it will treat it as error.

Choice of dependencies Example

The main dependency is axios which enables us to make the api calls. I've also added babel and jest.

How to use it

import getJsonFromUrls from 'multiple-json-urls'

const result = async () => {
  return await getJsons['url1, 'url2', 'url3']
}
1.0.0

3 years ago