Use Edge templating engine with Express
npm install express-edge --save
See the Edge documentation for how to structure your templates.
Requires Node.js 14+ from express-edge@3
const express = require('express');
const app = express();
const engine = require('express-edge');
// Automatically sets view engine and adds dot notation to app.render
app.use(engine);
app.set('views', `${__dirname}/views`);
// Configure view caching
app.enable('view cache');
// --- or ---
app.diable('view cache');
app.get('/', (req, res) => {
res.render('users.index', { users });
});
app.listen(3000);
MIT © Daniel Eckermann