Skip to content
Myr

Last expression is HTTP body

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parent 55840bb · Browse files · 1 file+10 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+10 added−7 removed

  • other:+10 added−7 removed

1 file+10 added−7 removed

modified:lib/express.core.js+10 added-7 removed
11 unmodified lines
12 13 defaultRoute : {14 callback : function() {15 Express.status('Not Found')16 return 'Not Found'16 'Not Found'17 }18 },19 20 /**
236 unmodified lines
257 * @api public258 */259 260 eval : function(string) {261 return eval('function(){ with (Express){' + string + '}}')261 return eval('with (Express){' + string + '}')262 },263 264 /**265 * Escape special characters in _html_.
72 unmodified lines
338 var route = this.findRouteFor(request) || this.defaultRoute339 if (route.keys)340 for (i = 0, len = route.keys.length; i < len; ++i) 341 this.request.uri.params[route.keys[i]] = Express.captures[i+1] || null342 return this.eval(Express.contentsOf(route.callback))()342 return this.eval(Express.contentsOf(route.callback)).toString()343 },344 345 /**346 * Attemp to find and return a route matching _request_.
85 unmodified lines
432 p(request.headers['Accept'])433 p(request.headers['Accept-Encoding'])434 p(request.headers['Cookie'])435 p(request.cookie)436 return param('operation') + 'ing ' + param('name')436 param('operation') + 'ing ' + param('name')437})438439get('articles', function(){440 display('spec/data/example.html.js')441 return 'list of articles'441 'list of articles'442})443444get(/articles\/(\d+)/, function(){445 return 'article id ' + captures[1]445 'article id ' + captures[1]446})447448get('articles/:name', function(){449 if (param('name') == 'tj')450 'hello tj'451 else449 return 'article name ' + param('name')452 'article name ' + param('name')453})454455Express.start()