app.js
This file
Path
examples/app.js
67 lines · 1.1 KiB · JavaScript
Last changed by
Plugin instances are request specificvisionmediabefore adoptionc6cc291
History of this fileTake it
The walk stopped after 200 commits: lines older than b5bbab9 point at it.
Added Collection#map()visionmediabefore adoptionb5bbab9
line 1why, one step back1Cleaning up example appvisionmediabefore adoption05e9cc6
line 2why, one step back2require.paths.unshift('lib')Added Collection#map()visionmediabefore adoptionb5bbab9
line 3why, one step back3require('express')Added plugins.js for quick plugin mixinsvisionmediabefore adoption39b0e43
line 4why, one step back4require('express/plugins')Added Collection#map()visionmediabefore adoptionb5bbab9
line 5why, one step back5Defaulting views to <root>/viewsvisionmediabefore adoption84a7c51
line 6why, one step back6configure(function(){Plugin instances are request specificvisionmediabefore adoptionc6cc291
line 7why, one step back7 use(CommonLogger)Cleaning up example appvisionmediabefore adoption05e9cc6
lines 8–9why, one step back8 use(MethodOverride)9 use(ContentLength)Defaulting views to <root>/viewsvisionmediabefore adoption84a7c51
line 10why, one step back10 set('root', dirname(__filename))Added "helpful 404" support pagevisionmediabefore adoption897c590
line 11why, one step back11 enable('helpful 404')Added "show exceptions" setting and specsvisionmediabefore adoptiondad297e
line 12why, one step back12 enable('show exceptions')Defaulting views to <root>/viewsvisionmediabefore adoption84a7c51
lines 13–15why, one step back13 enable('cache views')14})15Make route params request specificvisionmediabefore adoptiond0dae12
lines 16–18why, one step back16var messages = [],17 path = require('path'),18 posix = require('posix')Added chat example (though not practical over http)visionmediabefore adoption9c5552c
line 19why, one step back19CommonLogger showing "/" as rootvisionmediabefore adoption2b02305
lines 20–23why, one step back20get('/', function(){21 redirect('/chat')22})23Started chat examplevisionmediabefore adoption654c526
line 24why, one step back24get('/chat', function(){Added chat example (though not practical over http)visionmediabefore adoption9c5552c
lines 25–29why, one step back25 render('chat.haml.html', {26 locals: {27 messages: messages28 }29 })Cleaning up example appvisionmediabefore adoption05e9cc6
line 30why, one step back30})Added Collection#map()visionmediabefore adoptionb5bbab9
line 31why, one step back31Added chat example (though not practical over http)visionmediabefore adoption9c5552c
lines 32–38why, one step back32post('/chat', function(){33 messages.push(param('message'))34 halt(200)35})3637get('/chat/messages', function(){38 contentType('json')Added aliases of JSON.encode() and JSON.decode()visionmediabefore adoption0d9f502
line 39why, one step back39 return JSON.encode(messages)Added Collection#map()visionmediabefore adoptionb5bbab9
lines 40–41why, one step back40})41Make route params request specificvisionmediabefore adoptiond0dae12
lines 42–54why, one step back42StaticFile = Class({43 init: function(path) {44 this.path = path45 },46 47 send: function() {48 var self = this49 path.exists(this.path, function(exists){50 if (!exists) halt()51 posix.cat(self.path).addCallback(function(content){52 contentType(self.path)53 halt(200, content)54 })More example app stylingvisionmediabefore adoptionbb2e79f
line 55why, one step back55 })Make route params request specificvisionmediabefore adoptiond0dae12
lines 56–60why, one step back56 }57})5859get('/public/:file', function(file){60 (new StaticFile(dirname(__filename) + '/public/' + file)).send()More example app stylingvisionmediabefore adoptionbb2e79f
lines 61–62why, one step back61})62Started show exceptions supportvisionmediabefore adoptione728d3c
lines 63–66why, one step back63get('/error', function(){64 throw new Error('oh noes!')65})66Added Collection#map()visionmediabefore adoptionb5bbab9
line 67why, one step back67run()