Skip to content
Myr

Examples

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

authored by visionmedia · committed by visionmedia · parent c9eb31f · Browse files · 2 files+41 added−3 removed
This commit

State

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

Diff stats

2 files+41 added−3 removed

  • other:+41 added−3 removed

2 files+41 added−3 removed

modified:lib/express.core.js+14 added-3 removed
337 unmodified lines
338 put = Express.routeFunctionFor('put')339 340})()341342get('users', function(){343 if (param('user')) return 'user ' + param('user').name344 return 'users list'342get('user/:name/:operation', function(){343 return param('operation') + 'ing ' + param('name')344})345346get('articles', function(){347 return 'list of articles'348})349350get(/articles\/(\d+)/, function(){351 return 'article id ' + captures[1]352})353354get('articles/:name', function(){355 return 'article name ' + param('name')356})357358Express.start()
modified:README.rdoc+27 added
9 unmodified lines
1011* Sexy DSL12* Mime helpers13* Routing (string matching, regexp with captures, param key substitution, etc)14* Nested parameter parsing (user[name]=tj == { user : { name : 'tj' }})15* Full test coverage1617== Examples1819 // GET /user/tj/edit20 21 get('user/:name/:operation', function(){22 return param('operation') + 'ing ' + param('name')23 })2425 // GET /articles26 27 get('articles', function(){28 return 'list of articles'29 })3031 // GET /articles/1232 33 get(/articles\/(\d+)/, function(){34 return 'article id ' + captures[1]35 })3637 // GET /articles/foo38 39 get('articles/:name', function(){40 return 'article name ' + param('name')41 })4243== License 4445(The MIT License)46
20 unmodified lines