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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -