closest-http-endpoint

0.0.4 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i closest-http-endpoint

Weekly Downloads

1

Version

0.0.4

License

ISC

Unpacked Size

7.96 kB

Total Files

8

Last publish

Collaborators

  • martinlev