1.0.0 • Published 7 years ago
@steeplejack/restify v1.0.0
Steeplejack Restify
Restify strategy for Steeplejack
Usage
In your Steeplejack bootstrapping, you'll need to import this Restify plugin into the
modules
section:
app.js
const Steeplejack = require('steeplejack');
const restify = require('@steeplejack/restify');
/* Bootstrap the Steeplejack app */
const app = Steeplejack.app({
config: {},
modules: [
`${__dirname}/!(node_modules|routes)/**/*.js`,
restify,
],
routesDir: `${__dirname}/routes`,
});
app.run(['server'], server => server);
Now you've done that, you can create the server with the Restify strategy:
server.js
The
opts
object is the same opts as what is passed into the RestifycreateServer
method
exports.default = (Server, config, { Restify }) => {
const opts = {};
const restify = new Restify(opts);
return new Server(config.server, restify);
};
exports.inject = {
name: 'server',
deps: [
'steeplejack-server',
'$config',
'steeplejack-restify',
],
};
The steeplejack-restify
dependency exposes two elements, Restify
(the strategy) and restifyLib
(the restify
library).
License
MIT License