#glue
Server composer for hapi.js.
Lead Maintainer - Chris Rempel
Glue exports a single function compose
accepting a JSON manifest
file specifying the Hapi server options, connections and plugins. Glue primarily works in synergy with Rejoice, but can be integrated directly into any Hapi application loader.
compose(manifest, [options], callback)
manifest
- an object having:- 'server' - an object containing the options passed to
new Server([options])
- 'connections' - an array of connection options, passed individually in calls to
server.connection([options])
- 'plugins' - an object holding plugin entries to register with
server.register(plugins, [options], callback)
. Each key is thename
of the plugin to load and register and the value is the plugin options.
- 'server' - an object containing the options passed to
options
- an object having- 'relativeTo' - (optional) a file-system path string that is used to resolve loading modules with
require
. Used inserver.cache
andplugins[name]
- 'preConnections' - (optional) a callback function that is called prior to adding connections to the server. The function signature is
function (server)
where:server
- is the server object returned fromnew Server(options)
.
- 'prePlugins' - (optional) a callback function that is called prior to registering plugins with the server. The function signature is
function (server)
where:server
- is the server object with all connections selected.
- 'relativeTo' - (optional) a file-system path string that is used to resolve loading modules with
callback
- the callback function with signaturefunction (err, server)
where:err
- the error response if a failure occurred, otherwisenull
.server
- the server object. Callserver.start()
to actually start the server.