Get unlimited public & private packages + team-based management with npm Teams.Learn more »

wait-for-localhost

3.2.0 • Public • Published

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

useGet

Type: boolean
Default: false

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

Related

License

MIT © Sindre Sorhus

Install

npm i wait-for-localhost

DownloadsWeekly Downloads

1,835

Version

3.2.0

License

MIT

Unpacked Size

4.35 kB

Total Files

5

Last publish

Collaborators

  • avatar