node package manager
Loosely couple your services. Use Orgs to version and reuse your code. Create a free org »


BitSensor Node.js Plugin


Add bitsensor to your dependencies.

npm install bitsensor --save

Create a config.json file.

  "uri": "",
  "user": "your_username",
  "apiKey": "your_api_key",
  "mode": "on",
  "connectionFail": "block",
  "ipAddressSrc": "remoteAddr",
  "nodeApi": "http" or "hapi"

Run BitSensor inside your handleRequest() method.

var BitSensor = require('bitsensor/core/bitsensor');
var HttpHandler = require('bitsensor/handler/http-handler');
var fs = require('fs');
var http = require('http');
// Start BitSensor with the path of the config.json file as argument
var sensor = new BitSensor(fs.realpathSync('config.json'));
function handleRequest(request, response) {
    // Use the handler for http server
    sensor.addHandler(new HttpHandler(request, response));
    sensor.authorize(function () {
        // DoYaThing
    }, response);
var server = http.createServer(handleRequest);
server.listen(8080, function () {
    console.log('Server listening on http://localhost:8080');