node.js - Exporessjs Controller and action names in view files -
i have few routes like.
app.get('/help', controllers.static.help); app.get('/about', controllers.static.about); app.get('/posts', controllers.posts.index);
under layout.ejs
want fetch controller , action names , assign body class. like.
<body class="<%= locals.controllername %>_<%= locals.actionname %>">
in app have many hundred of such routes , don't want pass view parameters in each controller action.
is there central hook or way fetch above requirements?
Comments
Post a Comment