How do I pass content from a template to a layout in Express?

后端 未结 6 1599
忘了有多久
忘了有多久 2021-01-31 00:25

I have a basic Express server:

// server.js:
var Express = require(\'express\');
app = Express.createServer();
app.configure(function(){
  app.set(\'views\', Pat         


        
6条回答
  •  终归单人心
    2021-01-31 01:24

    Express does not have a preconceived notion of "blocks" or whatever they call that in in rails, but you can use a combination of helpers() and dynamicHelpers() to achieve something similar http://expressjs.com/guide.html#app-helpers-obj-

    Locals passed are available to both the layout and the page view though

提交回复
热议问题