app.js
This file
Path
examples/layout-control/app.js
32 lines · 750 bytes · JavaScript
Last changed by
Merge branch 'refactor/dev-deps'Tj Holowaychukbefore adoption7999386
History of this fileTake it
Merge branch 'feature/view-layout-control'Tj Holowaychukbefore adoption6a58c71
lines 1–14why, one step back12/**3 * Module dependencies.4 */56var express = require('../../lib/express');78var app = express.createServer();910app.set('views', __dirname + '/views');1112// set default layout, usually "layout"13app.set('view options', { layout: 'layouts/default' });14Merged pull request #645 from 8bitDesigner/patch-1.TJ Holowaychukbefore adoptionfc2bc13
line 15why, one step back15// Set our default template engine to "ejs"Merge branch 'feature/view-layout-control'Tj Holowaychukbefore adoption6a58c71
lines 16–32why, one step back16// which prevents the need for extensions17// (although you can still mix and match)18app.set('view engine', 'ejs');1920app.get('/', function(req, res){21 res.render('pages/default');22});2324app.get('/alternate', function(req, res){25 // note that we do not explicitly26 // state the layout here, the view does,27 // although we could do it here as well.28 res.render('pages/alternate');29});3031app.listen(3000);32console.log('Express app started on port 3000');