The API documentation is pretty good as a reference, but I could personally use a more comprehensive guide to routing in Express, or maybe even a generic routing standards and routing guidelines that spans across all server routing.
My situation is that I have some routes in path "/routes/index.js" and they have dependancies on some api requires in app.js, ala
--APP.JS--
var core = require("/core").data;
var app = express();
app.locals.core = core;
var routes = require('./routes')(app)
----------
--ROUTES/INDEX.JS--
module.exports = function(app){
// View list of core data
app.get('/core', function(req, res){
res.render('core', {
title: 'core' ,
core: app.locals.core
});
res.render('core', {
title: 'core' ,
core: app.locals.core,
user: app.locals.user
});
});
--------------------
And then, of course "/core.ejs" references all the data in core. Is app.locals really the right way to do this? I think this is going to get real messy with dynamic URLs and session-based objects being passed. I am just trying to have some foresight and build something that won't require a complete overhaul in the future. As you can see in the second route, it's being built dynamically based on which user is loaded in this instance of the application, and it's starting to get ugly.
I saw this app.param() entry in the API and I was thinking it might be party of my solution, but I don't think my core understanding of routing is good enough to simply read the API doc and be like "Oh yeah I get it, simple". Anyone have any suggestions for keeping this clean, anything from generic routing guides I could read up on to specific examples you could share?
Thanks much!