a plugin to display information about the server running including plugin versions
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
README.md
package-lock.json
package.json
yarn.lock

README.md

Build Status

hapi-info

hapi-info is a plugin to display information about the hapi server and the plugins it's running.

Usage

var HapiInfo = require('hapi-info');
var Hapi = require('hapi');

var server = new Hapi.Server();
server.connection();

server.register({ register: HapiInfo, options: {} }, function (err) {
    server.start(function () {
        // ..
    });
});

Options

The following options are available:

  • path: The route path where the information is available. Default: /hapi-info. Setting path to null means a route is not created but the server function is still exposed.
  • pluginFilter: A RegExp used to filter out plugins from the returned information.
  • options: boolean. default: false. when turned on, the options passed to the plugin will also be displayed

Output example

{
    "server":{
        "node":"v4.2.6",
        "hapi":"11.1.4",
        "host":"inis",
        "port":0,
        "uri":"http://inis"
    },
    "plugins":[
        {
            "name":"hapi-info",
            "version":"2.0.0"
        },
        {
            "name":"blah",
            "version":"1.2.3"
        },
        {
            "name":"main",
            "version":"0.1.1"
        }
    ]
}

server.plugins['hapi-info'].info()

The function server.plugins['hapi-info'].info() is also exposed and contains the same information as the endpoint as an object as opposed to json output.