Is my site up? Node.js edition.
$ npm install pin
var pin = require('pin');
pin('http://google.com/')
.interval(10000) // in ms
.up(function(response) {
console.log(response);
})
.down(function(error, response) {
console.log(error, response);
});
Both "up" and "down" are optional.
Check if text is present in the body:
var pin = require('pin');
pin('http://google.com/')
.interval(10000) // in ms
.text('Google')
.up(function(response) {
console.log(response);
})
Check if response is back under maximum duration:
var pin = require('pin');
pin('http://google.com/')
.interval(10000) // in ms
.maxDuration(800) // in ms
.up(function(response, info) {
console.log(response, info.duration);
})
Register custom validator:
var pin = require('pin');
var validator = function(err, response, body) {
// your custom checks here
// it must return bool
return true;
};
pin('http://google.com/')
.interval(10000) // in ms
.register(validator)
.up(function(response) {
console.log(response);
})
Register custom headers:
var pin = require('pin');
pin('http://google.com/')
.interval(10000) // in ms
.header('My-header', 'Foo')
.header('Other-header', 'Bar')
.up(function(response) {
console.log(response);
})
- Super minimalistic api
- Custom validators
- Check if text is present in the body
- Check response time
- Custom headers
$ npm install
$ make test
MIT License