app.js
This file
Path
examples/ejs/app.js
34 lines · 741 bytes · JavaScript
Last changed by
Merge branch 'docs'Tj Holowaychukbefore adoption64da262
History of this fileTake it
The walk stopped after 200 commits: lines older than a9db47f point at it.
Updated connect submoduleTj Holowaychukbefore adoptiona9db47f
lines 1–8why, one step back12// Expose modules in ./support for demo purposes3require.paths.unshift(__dirname + '/../../support');45/**6 * Module dependencies.7 */8docsTj Holowaychukbefore adoption6cae1f0
line 9why, one step back9var express = require('../../lib/express');Updated connect submoduleTj Holowaychukbefore adoptiona9db47f
lines 10–12why, one step back1011var app = express.createServer();12Merge branch 'docs'Tj Holowaychukbefore adoption64da262
lines 13–16why, one step back13// Register ejs as .html1415app.register('.html', require('ejs'));16Updated connect submoduleTj Holowaychukbefore adoptiona9db47f
lines 17–19why, one step back17// Optional since express defaults to CWD/views1819app.set('views', __dirname + '/views');Merge branch 'docs'Tj Holowaychukbefore adoption64da262
line 20why, one step back20app.set('view engine', 'html');Updated connect submoduleTj Holowaychukbefore adoptiona9db47f
lines 21–29why, one step back2122// Dummy users23var users = [24 { name: 'tj', email: 'tj@sencha.com' }25 , { name: 'ciaran', email: 'ciaranj@gmail.com' }26 , { name: 'aaron', email: 'aaron.heckmann+github@gmail.com' }27];2829app.get('/', function(req, res){Merge branch 'docs'Tj Holowaychukbefore adoption64da262
line 30why, one step back30 res.render('users', { users: users });Updated connect submoduleTj Holowaychukbefore adoptiona9db47f
lines 31–34why, one step back31});3233app.listen(3000);34console.log('Express app started on port 3000');