Skip to content
Myr

Markdown

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

authored by visionmedia · committed by visionmedia · parent 0739b0b · Browse files · 2 files+121 added−115 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+121 added−115 removed

  • other:+121 added−115 removed

2 files+121 added−115 removed

deleted:Readme-115 removed
12= Express34 Insanely fast (and small) server-side JavaScript web development framework5 built on node.js and the V8 JavaScript engine.67 * Stay tuned, coming soon :)89== Features (so far)1011 * Sexy DSL12 * Mime helpers13 * Nested parameter parsing14 * Full test coverage15 * Test helpers (mock requests etc)16 * Cookie support17 * Session support18 * Faux method support for RESTful apps19 * Extendable using Express 'Modules'20 * Static file serving21 * View support22 * Routing23 * string matching 24 * regexp with captures 25 * param key substitution26 * pre-conditions27 * overidding28 * etc29 30== Performance3132 Extensive benchmarking will wait until a development version33 has been released. However for simple an average route and response34 body Ruby's Sinatra scored 1454 request per second using Thin, while35 Express scored 2762.3637== Examples3839 // GET /user/tj/edit40 41 get('user/:name/:operation', function(){42 param('operation') + 'ing ' + param('name')43 })4445 // GET /articles46 47 get('articles', function(){48 'list of articles'49 })5051 // GET /articles/1252 53 get(/articles\/(\d+)/, function(){54 'article id ' + captures[1]55 })56 57 // POST /user/:id58 59 post('user/:id', function(){60 User.destroy(params('id')) ? 61 'User deleted' :62 'Failed to delete user'63 })64 65 // GET /login66 67 get('login', function() {68 '<form method="post" action="/login"> \69 <input type="text" name="user[name]" /> \70 <input type="password" name="user[pass]" /> \71 <input type="submit" value="Login"/> \72 </form>'73 })74 75 // POST /login7677 post('login', function() {78 'Welcome ' + param('user').name79 })80 81== Settings8283 * basepath : defaults to '/'84 * defaultRoute : responds with page not found85 * mime.defaultType : defaults to 'application/octet-stream'86 * cookie.maxAge : defaults to 3600 milliseconds87 88== Public API8990 * Coming Soon9192== License 9394(The MIT License)9596Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>9798Permission is hereby granted, free of charge, to any person obtaining99a copy of this software and associated documentation files (the100'Software'), to deal in the Software without restriction, including101without limitation the rights to use, copy, modify, merge, publish,102distribute, sublicense, and/or sell copies of the Software, and to103permit persons to whom the Software is furnished to do so, subject to104the following conditions:105106The above copyright notice and this permission notice shall be107included in all copies or substantial portions of the Software.108109THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,110EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF111MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.112IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY113CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,114TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE115SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
added:Readme.md+121 added
12# Express34 Insanely fast (and small) server-side JavaScript web development framework5 built on node.js and the V8 JavaScript engine.67 * Stay tuned, coming soon :)89## Features (so far)1011 * Sexy DSL12 * Mime helpers13 * Nested parameter parsing14 * Full test coverage15 * Test helpers (mock requests etc)16 * Cookie support17 * Session support18 * Faux method support for RESTful apps19 * Extendable using Express 'Modules'20 * Static file serving21 * View support22 * Routing23 * string matching 24 * regexp with captures 25 * param key substitution26 * pre-conditions27 * overidding28 * etc29 30## Performance3132 Extensive benchmarking will wait until a development version33 has been released. However for simple an average route and response34 body Ruby's Sinatra scored 1454 request per second using Thin, while35 Express scored 2762.3637## Examples3839 // GET /user/tj/edit40 41 get('user/:name/:operation', function(){42 param('operation') + 'ing ' + param('name')43 })4445 // GET /articles46 47 get('articles', function(){48 'list of articles'49 })5051 // GET /articles/1252 53 get(/articles\/(\d+)/, function(){54 'article id ' + captures[1]55 })56 57 // POST /user/:id58 59 post('user/:id', function(){60 User.destroy(params('id')) ? 61 'User deleted' :62 'Failed to delete user'63 })64 65 // GET /login66 67 get('login', function() {68 '<form method="post" action="/login"> \69 <input type="text" name="user[name]" /> \70 <input type="password" name="user[pass]" /> \71 <input type="submit" value="Login"/> \72 </form>'73 })74 75 // POST /login76 77 post('login', function() {78 'Welcome ' + param('user').name79 })80 81## Settings8283 * basepath : defaults to '/'84 * defaultRoute : responds with page not found85 * mime.defaultType : defaults to 'application/octet-stream'86 * cookie.maxAge : defaults to 3600 milliseconds87 88## Public API8990 * Coming Soon91 92## Testing9394Install [JSpec](http://jspec.info), edit the path to JSpec on your machine, and run:9596 $ node spec/spec.node.js9798## License 99100(The MIT License)101102Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>103104Permission is hereby granted, free of charge, to any person obtaining105a copy of this software and associated documentation files (the106'Software'), to deal in the Software without restriction, including107without limitation the rights to use, copy, modify, merge, publish,108distribute, sublicense, and/or sell copies of the Software, and to109permit persons to whom the Software is furnished to do so, subject to110the following conditions:111112The above copyright notice and this permission notice shall be113included in all copies or substantial portions of the Software.114115THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,116EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF117MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.118IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY119CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,120TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE121SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.