Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Is my site up? Node.js edition.
JavaScript
branch: master

Merge branch 'pr/4'

* pr/4:
  Fixed issue #3

Conflicts:
	lib/ping.js
latest commit ec7e45caa9
@vesln authored
Failed to load latest commit information.
lib Merge branch 'pr/4'
test res.statusCode is actually a number
.gitignore add performance check (maxDuration)
.travis.yml Add travis config
CHANGELOG.md history -> CHANGELOG
LICENSE License
Makefile make
Readme.md Readme improvements
package.json Use latest request

Readme.md

Build Status

Pin

Is my site up? Node.js edition.

Features

  • Minimalistic API
  • Custom validators
  • Check if text is present in the body
  • Check response time
  • Custom headers

Usage

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);
   })

Installation

$ npm install pin

License

MIT License

Something went wrong with that request. Please try again.