node-engine-light
be compatible with Engine Light
installation
$ npm install engine-light
documentation
Require engine-light
and create an object
var EngineLight = var engineLight =
Then use it right away to generate Engine Light compliant responses
engineLight// returns a Promise of '{"status":"ok","updated":1402120470799,"dependencies":[],"resources":{}}' engineLight// returns a Promise of '{"status":"doing aiight","updated":1402120470799,"dependencies":[],"resources":{}}'
You can add your own depdencies with the addDependency
function
engineLightengineLight// returns a Promise of '{"status":"ok","updated":1402120706100,"dependencies":["Postgres"],"resources":{}}'
You can add resources as well. addResource
takes two parameters:
The first is expected to be a string, and the name of the resource
The second (optional) is expected to be a function, that returns the current resource usage information as a percentage of the allowed limit.
{ var allowed used percentage = allowed/used * 100 return percentage} engineLightengineLight// returns a Promise of '{"status":"ok","updated":1402121246418,"dependencies":[],"resources":{"Sendgrid":17.85}}'
Engine Light can also be be used as middleware.
var express = var app = var EngineLight = var engineLight = app app
contributors
@jeremiak @jden
Please submit pull requests and issues through github.
You can run tests with npm test