Skip to content
Myr

app.js

This file

Path

examples/app.js

58 lines · 1.0 KiB · JavaScript

Last changed by

Moving CommonLogger in sample app lower to catch Content-Lengthvisionmediabefore adoption45cd102

History of this file

Take it

The walk stopped after 200 commits: lines older than dd76816 point at it.

Added Collection#reject()visionmediabefore adoptiondd76816

line 1why, one step back
1

Cleaning up example appvisionmediabefore adoption05e9cc6

line 2why, one step back
2require.paths.unshift('lib')

Added Collection#reject()visionmediabefore adoptiondd76816

line 3why, one step back
3require('express')

Added plugins.js for quick plugin mixinsvisionmediabefore adoption39b0e43

line 4why, one step back
4require('express/plugins')

Added Collection#reject()visionmediabefore adoptiondd76816

line 5why, one step back
5

Defaulting views to <root>/viewsvisionmediabefore adoption84a7c51

line 6why, one step back
6configure(function(){

Cleaning up example appvisionmediabefore adoption05e9cc6

lines 7–8why, one step back
7 use(MethodOverride)
8 use(ContentLength)

Moving CommonLogger in sample app lower to catch Content-Lengthvisionmediabefore adoption45cd102

line 9why, one step back
9 use(CommonLogger)

Defaulting views to <root>/viewsvisionmediabefore adoption84a7c51

line 10why, one step back
10 set('root', dirname(__filename))

Added "helpful 404" support pagevisionmediabefore adoption897c590

line 11why, one step back
11 enable('helpful 404')

Added "show exceptions" setting and specsvisionmediabefore adoptiondad297e

line 12why, one step back
12 enable('show exceptions')

Defaulting views to <root>/viewsvisionmediabefore adoption84a7c51

lines 13–15why, one step back
13 enable('cache views')
14})15

Make route params request specificvisionmediabefore adoptiond0dae12

lines 16–18why, one step back
16var messages = [],
17 path = require('path'),18 posix = require('posix')

Added chat example (though not practical over http)visionmediabefore adoption9c5552c

line 19why, one step back
19

CommonLogger showing "/" as rootvisionmediabefore adoption2b02305

line 20why, one step back
20get('/', function(){

Evaulating routes in context to their given request instancevisionmediabefore adoption0f3a764

line 21why, one step back
21 this.redirect('/chat')

CommonLogger showing "/" as rootvisionmediabefore adoption2b02305

lines 22–23why, one step back
22})
23

Started chat examplevisionmediabefore adoption654c526

line 24why, one step back
24get('/chat', function(){

Moved render() to Requestvisionmediabefore adoptione182388

line 25why, one step back
25 this.render('chat.haml.html', {

Added chat example (though not practical over http)visionmediabefore adoption9c5552c

lines 26–29why, one step back
26 locals: {
27 messages: messages28 }29 })

Cleaning up example appvisionmediabefore adoption05e9cc6

line 30why, one step back
30})

Added Collection#reject()visionmediabefore adoptiondd76816

line 31why, one step back
31

Added chat example (though not practical over http)visionmediabefore adoption9c5552c

line 32why, one step back
32post('/chat', function(){

Moved render() to Requestvisionmediabefore adoptione182388

line 33why, one step back
33 messages.push(this.param('message'))

Evaulating routes in context to their given request instancevisionmediabefore adoption0f3a764

line 34why, one step back
34 this.halt(200)

Added chat example (though not practical over http)visionmediabefore adoption9c5552c

lines 35–37why, one step back
35})
3637get('/chat/messages', function(){

Evaulating routes in context to their given request instancevisionmediabefore adoption0f3a764

line 38why, one step back
38 this.contentType('json')

Added aliases of JSON.encode() and JSON.decode()visionmediabefore adoption0d9f502

line 39why, one step back
39 return JSON.encode(messages)

Added Collection#reject()visionmediabefore adoptiondd76816

lines 40–41why, one step back
40})
41

Make route params request specificvisionmediabefore adoptiond0dae12

line 42why, one step back
42get('/public/:file', function(file){

Moved render() to Requestvisionmediabefore adoptione182388

lines 43–51why, one step back
43 var self = this
44 file = dirname(__filename) + '/public/' + file45 path.exists(file, function(exists){46 if (!exists) self.halt()47 posix.cat(file).addCallback(function(content){48 self.contentType(file)49 self.halt(200, content)50 })51 })

More example app stylingvisionmediabefore adoptionbb2e79f

lines 52–53why, one step back
52})
53

Started show exceptions supportvisionmediabefore adoptione728d3c

lines 54–57why, one step back
54get('/error', function(){
55 throw new Error('oh noes!')56})57

Added Collection#reject()visionmediabefore adoptiondd76816

line 58why, one step back
58run()