Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seikho/node-http-ping
A simple website pinger for node
https://github.com/seikho/node-http-ping
Last synced: 5 days ago
JSON representation
A simple website pinger for node
- Host: GitHub
- URL: https://github.com/seikho/node-http-ping
- Owner: Seikho
- License: mit
- Created: 2015-03-18T12:41:54.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-07T04:34:58.000Z (over 6 years ago)
- Last Synced: 2024-10-04T19:16:04.109Z (about 1 month ago)
- Language: TypeScript
- Size: 54.7 KB
- Stars: 8
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# node-http-ping
A simple, light-weight JavaScript module for pinging HTTP services
### Installation
```
npm install node-http-ping --save
```### Usage
```javascript
import ping from 'node-http-ping'
// or
const ping = require('node-http-ping')// Using http by default
ping('google.com', 80 /* optional */)
.then(time => console.log(`Response time: ${time}ms`))
.catch(() => console.log(`Failed to ping google.com`))// Or use https
ping('https://google.com')
.then(time => console.log(`Response time: ${time}ms`))
.catch(() => console.log('Failed to ping google.com'))
```