@asdsadw12312dwd2112xz/api-health-cli
v1.0.0
Published
Check API endpoint health with beautiful dashboard output
Maintainers
Readme
api-health-cli
Check API endpoint health with beautiful dashboard output.
Installation
npm install -g api-health-cliUsage
Check a single endpoint
api-health https://api.example.com/healthCheck multiple endpoints from a config file
api-health --config endpoints.jsonendpoints.json format:
[
{ "url": "https://api.example.com/health", "name": "Main API" },
{ "url": "https://auth.example.com/ping", "name": "Auth Service", "expectedStatus": 200 }
]Options
| Flag | Description |
|------|-------------|
| --config <file> | JSON config file with endpoints array |
| --json | Output as JSON |
| --interval <seconds> | Continuous monitoring every N seconds |
| --timeout <ms> | Request timeout in ms (default: 10000) |
| -H, --headers <header...> | Custom headers |
| --expected-status <code> | Expected HTTP status code (default: 200) |
| --expected-body <string> | Check that response body contains this string |
Examples
# JSON output
api-health https://api.example.com/health --json
# Continuous monitoring every 30 seconds
api-health --config endpoints.json --interval 30
# Custom timeout
api-health https://api.example.com/health --timeout 5000
# Custom headers
api-health https://api.example.com/health -H "Authorization: Bearer mytoken"
# Expect specific status and body
api-health https://api.example.com/health --expected-status 200 --expected-body '"status":"ok"'Output
- Green = healthy (2xx, fast response)
- Yellow = slow (>1000ms)
- Red = down or error
SSL certificate expiry is shown for HTTPS endpoints.
License
MIT © okirmio-create
