Skip to content
/ pin Public
forked from vesln/pin

Is my site up? Node.js edition.

Notifications You must be signed in to change notification settings

hgoebl/pin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Pin

Is my site up? Node.js edition.

Install

$ npm install pin

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

Features

  • Super minimalistic api
  • Custom validators
  • Check if text is present in the body
  • Check response time
  • Custom headers

Tests

$ npm install
$ make test

License

MIT License

About

Is my site up? Node.js edition.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%