Skip to content
Wait for localhost to be ready
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig
.gitattributes
.gitignore
.npmrc
.travis.yml
index.d.ts
index.js
index.test-d.ts
license
package.json
readme.md
test.js

readme.md

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

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.