In my Node/Express.js project I can set the views folder globally like so:
app.configure(function() {
app.set(\'views\', __dirname + \'/views\');
.... sn
Full path works too
app.get('/', function(req, res) {
res.render(path.join(__dirname, 'view.jade'));
});
As a more modular solution, I did something like this in sails.js. Just over-ride the render function for the given request in your middleware. :)
var curRender = res.render;
res.render = function(path, locals, func) {
var args = [res.locals.explicitPath + '/' + path, locals, func];
curRender.apply(this, args);
};
The 'views' setting is the root directory, so you should be able to specify a sub-folder in the hierarchy:
app.get('/', function(req, res) {
res.render('areaName/viewName');
});
It means your 'areas' need to be sub-folders, but it allows you to accomplish the separation you are looking for.