Skip to content
Myr

app.js

This file

Path

examples/layout-control/app.js

35 lines · 854 bytes · JavaScript

Last changed by

Merge branch 'feature/view-layout-control'Tj Holowaychukbefore adoption6a58c71

History of this file

Take it

Merge branch 'feature/view-layout-control'Tj Holowaychukbefore adoption6a58c71

lines 1–35why, one step back
1
2// Expose modules in ./support for demo purposes3require.paths.unshift(__dirname + '/../../support');45/**6 * Module dependencies.7 */89var express = require('../../lib/express');1011var app = express.createServer();1213app.set('views', __dirname + '/views');1415// set default layout, usually "layout"16app.set('view options', { layout: 'layouts/default' });1718// Set our default template engine to "jade"19// which prevents the need for extensions20// (although you can still mix and match)21app.set('view engine', 'ejs');2223app.get('/', function(req, res){24 res.render('pages/default');25});2627app.get('/alternate', function(req, res){28 // note that we do not explicitly29 // state the layout here, the view does,30 // although we could do it here as well.31 res.render('pages/alternate');32});3334app.listen(3000);35console.log('Express app started on port 3000');