# bitsensor

> BitSensor Node.js Plugin

Latest version **0.9.0** (published 2016-12-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install bitsensor
pnpm add bitsensor
yarn add bitsensor
bun add bitsensor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.0 |
| Published | 2016-12-15 |
| First published | 2016-12-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 14 |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| Author | BitSensor |
| Maintainers | bitsensor-bram |
| Keywords | security, insight |

## Links

- npm: https://www.npmjs.com/package/bitsensor
- Repository: https://git.bitsensor.io/plugins/node-js
- Homepage: https://bitsensor.io/
- Issues: https://git.bitsensor.io/plugins/node-js/issues
- npm.io page: https://npm.io/package/bitsensor

## Dependencies (14)

- [os](https://npm.io/package/os.md) ^0.1.1
- [events](https://npm.io/package/events.md) ^1.1.1
- [moment](https://npm.io/package/moment.md) ^2.10.6
- [rwlock](https://npm.io/package/rwlock.md) ^5.0.0
- [express](https://npm.io/package/express.md) ^4.14.0
- [request](https://npm.io/package/request.md) ^2.79.0
- [crypto-js](https://npm.io/package/crypto-js.md) ^3.1.5
- [body-parser](https://npm.io/package/body-parser.md) ^1.15.2
- [monkeypatch](https://npm.io/package/monkeypatch.md) ^1.0.0
- [stack-trace](https://npm.io/package/stack-trace.md) 0.0.9
- [cookie-parser](https://npm.io/package/cookie-parser.md) ^1.4.3
- [express-session](https://npm.io/package/express-session.md) ^1.14.2
- [merge-descriptors](https://npm.io/package/merge-descriptors.md) ^1.0.1
- [continuation-local-storage](https://npm.io/package/continuation-local-storage.md) ^3.2.0

## Recent versions

- 0.9.0 (latest) — 2016-12-15

## README

# BitSensor Node.js Plugin
## Usage
Add ``bitsensor`` to your dependencies.

`` npm install bitsensor --save ``

Create a ``config.json`` file.

```json
{
  "uri": "http://bitsensor.io/api/",
  "user": "your_username",
  "apiKey": "your_api_key",
  "mode": "on",
  "connectionFail": "block",
  "ipAddressSrc": "remoteAddr",
  "nodeApi": "http" or "hapi"
}
```

Run BitSensor inside your ``handleRequest()`` method.

```node
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.runHandlers();
    sensor.authorize(function () {
        // DoYaThing
    }, response);
}

var server = http.createServer(handleRequest);

server.listen(8080, function () {
    console.log('Server listening on http://localhost:8080');
});
```

---
_Source: https://npm.io/package/bitsensor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
