lev-restify

4.2.0 • Public • Published

Life Event Verification's Restify server

A highly opinionated Restify server for use in the Life Event Verification (LEV) project.

The server features:

  • JSON logging (via Bunyan) and logs special headers provided by keycloak-gatekeeper.
  • A simple liveness health-check on /healthz.
  • 'Secure' headers on every response.
  • Bundled functionality for custom metrics and some helper functions.

Usage

Simple require this package:

const restify = require('lev-restify');

You can then create a Restify server using createServer() and access bundled functionality by accessing properties on the object.

const httpd = restify.createServer({ name: 'my-server' });
const log = httpd.log;

httpd.listen(8080, '0.0.0.0', () => {
  log.info('%s listening at %s', httpd.name, httpd.url);
});

(In addition, the object returned by createServer() has an extra property, .log which contains the logger. This can be used for logging outside the context of a request, when req.log is available.)

Testing

To test changes to this repository simply run:

make test

Readme

Keywords

none

Package Sidebar

Install

npm i lev-restify

Weekly Downloads

2

Version

4.2.0

License

ISC

Unpacked Size

18.8 kB

Total Files

22

Last publish

Collaborators

  • aarongill
  • james.woodward
  • daniel-ac-martin