Sorry for posting my question, but I need a similar solution for my application. It would be great to define layouts in routes.js so that, for example, / admin / * uses one layout and, for example. / app / * will use another, etc. Because itβs lavash, plunging into controllers and overloading them with static layouts. I tried this concept, but it seems to work only if I also define a controller in the routes.js configuration file , for example:
module.exports.routes = { '/admin/*' : { controller: 'AdminController', action: 'index', locals: { layout: 'admin/layout' } } };
This works, but directs all actions for the administrator to the same controller, which, of course, is wrong. If I omit part of the controller, this concept always uses the default view /layout.ejs, and the local one is not set:
module.exports.routes = { '/admin/*' : { locals: { layout: 'admin/layout' } } };
This does not work, but it would be ideal to get it that way.
cybercow
source share