Just to follow up...I ended up just replacing this:
res.render('home', data);
with this:
req.user ? res.render('home', data) : res.render('welcome');
in the src/controllers/index.js file.
This may or may not have side effects...not sure yet...
I tried to come up with other ways, but this seems the most straight forward. If there is an approach that this can be achieved via hooks I'd love to know...
Also, from src/routes/index.js can someone explain this:
function setupPageRoute(router, name, middleware, middlewares, controller) {
middlewares = middlewares.concat([middleware.incrementPageViews, middleware.updateLastOnlineTime]);
router.get(name, middleware.buildHeader, middlewares, controller);
router.get('/api' + name, middlewares, controller);
}
For the router.get()
methods, are they like Express' app.get
? And if so, I thought unless you pass in next
to the method you can't provide more than 1 route? How is it getting the main route plus the api route?