Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sindresorhus/wait-for-localhost-cli
Wait for localhost to be ready from the command-line
https://github.com/sindresorhus/wait-for-localhost-cli
cli-app delay localhost nodejs npm-package server wait
Last synced: about 2 months ago
JSON representation
Wait for localhost to be ready from the command-line
- Host: GitHub
- URL: https://github.com/sindresorhus/wait-for-localhost-cli
- Owner: sindresorhus
- License: mit
- Created: 2018-06-08T17:07:17.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-11-01T11:58:30.000Z (11 months ago)
- Last Synced: 2024-04-14T09:51:27.391Z (5 months ago)
- Topics: cli-app, delay, localhost, nodejs, npm-package, server, wait
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 115
- Watchers: 5
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# wait-for-localhost-cli
> Wait for localhost to be ready from the command-line
Useful if you need a local server to be ready to accept requests before executing the next command.
I personally use this to wait for [`webpack-dev-server`](https://github.com/webpack/webpack-dev-server) to be ready before launching Electron.
## Install
```sh
npm install --global wait-for-localhost-cli
```## Usage
```
$ wait-for-localhost --helpUsage
$ wait-for-localhost [port]Options
--use-get Use the HTTP-method GET instead of HEAD to test if the server is ready.
--path Use a custom path. For example, /health for a health-check endpoint.
--status-codes Define status codes indicating the server is ready. [Default: 200]Examples
$ wait-for-localhost 8080 && echo 'Server is ready'
$ wait-for-localhost 8080 --status-codes 200,201 && echo 'Server is ready'
```## Related
- [wait-for-localhost](https://github.com/sindresorhus/wait-for-localhost) - API for this package
- [delay-cli](https://github.com/sindresorhus/delay-cli) - Delay execution for a given amount of seconds