Skip to content

martinlevesque/closest-http-endpoint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Find to closest HTTP(s) endpoint given a list of URLs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published