1let express = require('express');
2let app = express();
3
4app.set('view engine', 'ejs');
5
6app.get('/', (req, res) => {
7 res.render('index', {foo: 'FOO'});
8});
9
10app.listen(4000, () => console.log('Example app listening on port 4000!'));
1var express = require('express');
2var expressLayouts = require('express-ejs-layouts');
3var app = express(); app.set('view engine', 'ejs');
4app.use(expressLayouts);
5app.get('/', function(req, res) {
6 var locals = {
7 title: 'Page Title',
8 description: 'Page Description',
9 header: 'Page Header' };
10 res.render('the-view', locals);
11}); app.listen(3000);