Some added sugar on top of express to give our app some sensible defaults and a little structure.
npm install elephas --save
var config = {
__dirname: __dirname,
server: {
port: 3000,
cluster: false
},
httpsOnly: process.env.NODE_ENV === 'production'
};
var elephas = require('elephas')(config);
elephas.createServer();
##Options ...
##Hooks
Using the following hooks, you can jump in between each stage of the boot process to run your own code. You MUST execute the done()
callback so that the boot process can continue. All hooks are optional.
elephas.createServer({
beforeRoutes: function(done, app) {
// Do some stuff here
done(); // Let elephas know when you have finished
}
});
####List of hooks (in order of execution)
- beforeServices
- beforeMiddleware
- beforeRoutes
- afterRoutes
- onComplete
npm test