Socket
Socket
Sign inDemoInstall

wait-for-localhost

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    wait-for-localhost

Wait for localhost to be ready


Version published
Weekly downloads
3.6K
increased by9.75%
Maintainers
1
Install size
5.60 kB
Created
Weekly downloads
 

Readme

Source

wait-for-localhost Build Status

Wait for localhost to be ready

Useful if you need a local server to be ready to accept requests before doing other things.

Install

$ npm install --global wait-for-localhost

Usage

const waitForLocalhost = require('wait-for-localhost');

(async () => {
	await waitForLocalhost({port: 8080});
	console.log('Server is ready');
})();

API

waitForLocalHost([options])

Returns a Promise that settles when localhost is ready.

options

Type: Object

port

Type: number
Default: 80

path

Type: string
Default: '/'

Use a custom path.

For example, /health for a health-check endpoint.

useGet

Type: boolean
Default: false

Use the GET HTTP-method instead of HEAD to check if the server is running.

License

MIT © Sindre Sorhus

Keywords

FAQs

Last updated on 24 Jul 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc