app.js
This file
Path
examples/chat/app.js
80 lines · 1.8 KiB · JavaScript
Last changed by
http client fix from node renaming close to endvisionmediabefore adoption7b83a52
History of this fileTake it
The walk stopped after 200 commits: lines older than 3863a76 point at it.
Merge branch 'flash'visionmediabefore adoption3863a76
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 = [],http client fix from node renaming close to endvisionmediabefore adoption7b83a52
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 Merge branch 'flash'visionmediabefore adoption3863a76
line 10why, one step back10configure(function(){request response event is now fired in reverse.visionmediabefore adoption906ef02
line 11why, one step back11 use(Logger)Merge branch 'flash'visionmediabefore adoption3863a76
lines 12–14why, one step back12 use(MethodOverride)13 use(ContentLength)14 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)Merge branch 'flash'visionmediabefore adoption3863a76
lines 18–20why, one step back18 set('root', __dirname)19})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')Merge branch 'flash'visionmediabefore adoption3863a76
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 'flip-views'visionmediabefore adoption6b13fc9
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 })Merge branch 'flash'visionmediabefore adoption3863a76
lines 37–60why, one step back37})3839post('/chat', function(){40 this.session.name = this.param('name')41 messages42 .push(utils.escape(this.param('name')) + ': ' + utils.escape(this.param('message'))43 .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">'))45 this.halt(200)46})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,55 self.halt(200, JSON.encode(messages)),56 clearInterval(timer)57 }, 100)58})5960get('/*.css', function(file){Merge branch 'flip-views'visionmediabefore adoption6b13fc9
line 61why, one step back61 this.render(file + '.css.sass', { layout: false })Merge branch 'flash'visionmediabefore adoption3863a76
lines 62–80why, 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 :)'74})7576get('/favicon.ico', function(){77 this.halt()78})7980run()