0.0.4 • Published 5 years ago

closest-http-endpoint v0.0.4

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

closest-http-endpoint

NPM

Build status

This package allows to find the closest HTTP/HTTPS endpoint given an array of URLs. This can be useful to find for instance which server (HTTP-based) is the closest without complex verification.

Installation

npm install closest-http-endpoint

Usage Example

const closestHttpEndpoint = require("closest-http-endpoint")(options)

async function yourfunction() {
  const result = await closestHttpEndpoint(["http://myurl.com/", "https://google.com/"])

  // result will equal to either http://myurl.com/ or https://google.com/
}

Options

Currently available options are the following:

{
  timeoutRequest: 10 // 10 seconds maximum timeout
}

License

ISC

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago