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
1234567891011121314151617181920212223242526272829303132333435363738394041
// Expose modules in ./support for demo purposesrequire.paths.unshift(__dirname + '/../../support');
/** * Module dependencies. */
var express = require('../../lib/express');
var app = express.createServer();
// Optional since express defaults to CWD/views
app.set('views', __dirname + '/views');
// Set our default template engine to "jade"// which prevents the need for extensions// (although you can still mix and match)app.set('view engine', 'jade');
// Dummy recordvar ninja = { name: 'leonardo', summary: { email: 'hunter.loftis+github@gmail.com', master: 'splinter', description: 'peaceful leader' }, weapons: ['katana', 'fists', 'shell'], victims: ['shredder', 'brain', 'beebop', 'rocksteady']};
app.get('/', function(req, res){ res.render('ninjas', { ninja: ninja });});
app.get('/li', function(req, res){ res.partial('li', { object: 'Testing', as: 'value' });});
app.listen(3000);console.log('Express app started on port 3000');