-
Notifications
You must be signed in to change notification settings - Fork 459
Using krakenjs middleware config for express subapps mounting
Aria Stewart edited this page Apr 13, 2015
·
8 revisions
This module exports a function which returns an app
//in 'subapp' module's index.js
var express = require('express');
var jade = require('jade');
module.exports = function() {
var app = express();
//setup anything app specific
// view engine
app.set('view engine', 'jade');
// view paths - relative to the module's path
app.set('views', './views')
// routes
app.get('/login', require('./path/to/loginMiddleware'));
app.post('/login', require('./path/to/loginPostMiddleware'));
app.get('/some/other/route', require('./path/to/otherRouteMiddleware'));
return app;
}
Then we include the subapp
module in <env>.json
's middleware section
{
"middleware": {
"subapp" : {
"enabled" : true,
"priority": 100 /*your appropriate priority*/,
"module": {
"name": "subapp"
}
}
}
}