app.js
This file
Path
examples/chat/app.js
80 lines · 1.8 KiB · JavaScript
Last changed by
Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
History of this fileTake it
The walk stopped after 200 commits: lines older than fbf547d point at it.
Added Session classvisionmediabefore adoptionfbf547d
lines 1–5why, one step back12require.paths.unshift('lib')3require('express')4require('express/plugins')5Managing dependencies with the kiwi package manager. Closes #228visionmediabefore adoption6da4a94
line 6why, one step back6var messages = [],Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
lines 7–8why, one step back7 utils = require('express/utils'),8 http = require('express/http')Fixed requiring of haml / sassvisionmediabefore adoptionb62e174
line 9why, one step back9 Added Session classvisionmediabefore adoptionfbf547d
line 10why, one step back10configure(function(){request response event is now fired in reverse.visionmediabefore adoption906ef02
line 11why, one step back11 use(Logger)Added Session classvisionmediabefore adoptionfbf547d
lines 12–13why, one step back12 use(MethodOverride)13 use(ContentLength)We cannot use(Cookie) within Session.init()visionmediabefore adoption7cdbca0
line 14why, one step back14 use(Cookie)Chat example using millisecond conversions from extvisionmediabefore adoptionf23ef09
lines 15–16why, one step back15 use(Cache, { lifetime: (5).minutes, reapInterval: (1).minute })16 use(Session, { lifetime: (15).minutes, reapInterval: (1).minute })Closes #88.visionmediabefore adoptionb8f54d6
line 17why, one step back17 use(Static)Mergevisionmediabefore adoptioncec6770
line 18why, one step back18 set('root', __dirname)Added Session classvisionmediabefore adoptionfbf547d
lines 19–20why, one step back19})20Merge branch 'net2_fixes' of git://github.com/ciaranj/expressvisionmediabefore adoptionbd74fe2
line 21why, one step back21get('/', function(){ Chat sample app using pass()visionmediabefore adoption79143f3
line 22why, one step back22 this.pass('/chat')Added Session classvisionmediabefore adoptionfbf547d
lines 23–24why, one step back23})24Request instance created before body parsing. Closes #262visionmediabefore adoptiona74c259
line 25why, one step back25get('/chat', function(){Removed a comment from chat appvisionmediabefore adoptionf5da81e
lines 26–27why, one step back26 var self = this27 Session.store.length(function(err, len){Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
line 28why, one step back28 self.render('chat.html.haml', {Merge branch 'integration'visionmediabefore adoption33443d9
lines 29–32why, one step back29 locals: {30 title: 'Chat',31 messages: messages,32 name: self.session.name,Removed a comment from chat appvisionmediabefore adoptionf5da81e
line 33why, one step back33 usersOnline: lenMerge branch 'integration'visionmediabefore adoption33443d9
lines 34–35why, one step back34 }35 })Removed a comment from chat appvisionmediabefore adoptionf5da81e
line 36why, one step back36 })Added Session classvisionmediabefore adoptionfbf547d
lines 37–39why, one step back37})3839post('/chat', function(){More session workvisionmediabefore adoption047499d
line 40why, one step back40 this.session.name = this.param('name')Added Session classvisionmediabefore adoptionfbf547d
line 41why, one step back41 messagesMergevisionmediabefore adoptioncec6770
line 42why, one step back42 .push(utils.escape(this.param('name')) + ': ' + utils.escape(this.param('message'))Added Session classvisionmediabefore adoptionfbf547d
lines 43–44why, one step back43 .replace(/(http:\/\/[^\s]+)/g, '<a href="$1" target="express-chat">$1</a>')44 .replace(/:\)/g, '<img src="http://icons3.iconfinder.netdna-cdn.com/data/icons/ledicons/emoticon_smile.png">'))Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
line 45why, one step back45 this.respond(200)Added Session classvisionmediabefore adoptionfbf547d
lines 46–54why, one step back46})4748get('/chat/messages', function(){49 var self = this,50 previousLength = messages.length,51 timer = setInterval(function(){52 if (messages.length > previousLength)53 self.contentType('json'),54 previousLength = messages.length,Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
line 55why, one step back55 self.respond(200, JSON.encode(messages)),Added Session classvisionmediabefore adoptionfbf547d
lines 56–60why, one step back56 clearInterval(timer)57 }, 100)58})5960get('/*.css', function(file){Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
line 61why, one step back61 this.render(file + '.css.sass', { layout: false })Added Session classvisionmediabefore adoptionfbf547d
lines 62–73why, one step back62})6364get('/error/view', function(){65 this.render('does.not.exist')66})6768get('/error', function(){69 throw new Error('oh noes!')70})7172get('/simple', function(){73 return 'Hello :)'Session docsvisionmediabefore adoption9d5a6f9
lines 74–76why, one step back74})7576get('/favicon.ico', function(){Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
line 77why, one step back77 this.notFound()Added Session classvisionmediabefore adoptionfbf547d
lines 78–80why, one step back78})7980run()