In my express app, I've changed the view engine to ejs.
Does anyone know if it is still possible to take advantage of view templates?
Actually after Express 3.X is not support layout.ejs, if you want to use the layout, following steps should be done by yourself:
package.json file
     "dependencies": {
       "express": "3.1.0",
       "ejs": "*",
       "express-partials": "*"
     }
npm install to install the latest version of express-partials
express-partials in your app.jsvar partials = require('express-partials');
app.use(partials()); under the app.set('view engine', 'ejs'); in app.js fileafter that, you can design you layout.ejs and add <%- body%> block in your layout.ejs file, and that's enough and working well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With