app.js
This file
Path
examples/partials/app.js
40 lines · 974 bytes · JavaScript
Last changed by
Added res.partial(), using the same interface as partial() within a view. Closes #539Tj Holowaychukbefore adoptiondd9406c
History of this fileTake it
The walk stopped after 200 commits: lines older than 749136b point at it.
renamed example to paramsTj Holowaychukbefore adoption635fac7
line 1why, one step back1Added app.disabled() and app.enabled()Tj Holowaychukbefore adoption749136b
lines 2–30why, one step back2// 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();1213// Optional since express defaults to CWD/views1415app.set('views', __dirname + '/views');1617// Set our default template engine to "jade"18// which prevents the need for extensions19// (although you can still mix and match)20app.set('view engine', 'jade');2122// Dummy record23var ninja = {24 name: 'leonardo',25 summary: { email: 'hunter.loftis+github@gmail.com', master: 'splinter', description: 'peaceful leader' },26 weapons: ['katana', 'fists', 'shell'],27 victims: ['shredder', 'brain', 'beebop', 'rocksteady']28};2930app.get('/', function(req, res){partials example utilizing indexTj Holowaychukbefore adoption5093127
line 31why, one step back31 res.render('ninjas', { ninja: ninja });Added app.disabled() and app.enabled()Tj Holowaychukbefore adoption749136b
lines 32–33why, one step back32});33Added res.partial(), using the same interface as partial() within a view. Closes #539Tj Holowaychukbefore adoptiondd9406c
lines 34–38why, one step back34app.get('/li', function(req, res){35 res.partial('li', { object: 'Testing', as: 'value' });36});3738Added app.disabled() and app.enabled()Tj Holowaychukbefore adoption749136b
lines 39–40why, one step back39app.listen(3000);40console.log('Express app started on port 3000');