Readme.md
This file
Path
Readme.md
140 lines · 4.0 KiB · Markdown
Last changed by
Amended readme for running individual specscsausdevbefore adoption0a911dd
History of this fileTake it
Markdownvisionmediabefore adoptionfa08323
lines 1–4why, one step back12# Express34 Insanely fast (and small) server-side JavaScript web development frameworkDocsvisionmediabefore adoption9f06b11
line 5why, one step back5 built on **node.js** and the **V8 JavaScript engine**.Markdownvisionmediabefore adoptionfa08323
lines 6–29why, one step back67 * 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 Added example, extra info to Readmecsausdevbefore adoption3491ff3
lines 30–36why, one step back30## Limitations3132Note that the current version does not cope with url handlers that do not return a string.33So, any asynchronous operations made in your handler won't get executed properly (i.e. the handler will return,34terminating the http response, before your callbacks return). This will be fixed very soon - I have a dodgy hack coded up that works,35but is far too embarrassing to show the world.36Markdownvisionmediabefore adoptionfa08323
lines 37–40why, one step back37## Performance3839 Extensive benchmarking will wait until a development version40 has been released. However for simple an average route and responseDocsvisionmediabefore adoption9f06b11
lines 41–42why, one step back41 body Ruby's Sinatra scored **1454** request per second using Thin, while42 Express scored **2762**.Markdownvisionmediabefore adoptionfa08323
lines 43–44why, one step back4344## ExamplesAdded example, extra info to Readmecsausdevbefore adoption3491ff3
line 45why, one step back45Amended readme for running individual specscsausdevbefore adoption0a911dd
line 46why, one step back46See examples/simple.js for a working server. Just type "node examples/simple.js" and then go to http://localhost:3000/hello/worldMarkdownvisionmediabefore adoptionfa08323
line 47why, one step back47Docsvisionmediabefore adoption9f06b11
line 48why, one step back48GET /user/tj/editMarkdownvisionmediabefore adoptionfa08323
lines 49–53why, one step back49 50 get('user/:name/:operation', function(){51 param('operation') + 'ing ' + param('name')52 })53Docsvisionmediabefore adoption9f06b11
line 54why, one step back54GET /articlesMarkdownvisionmediabefore adoptionfa08323
lines 55–59why, one step back55 56 get('articles', function(){57 'list of articles'58 })59Docsvisionmediabefore adoption9f06b11
line 60why, one step back60GET /articles/12Markdownvisionmediabefore adoptionfa08323
lines 61–65why, one step back61 62 get(/articles\/(\d+)/, function(){63 'article id ' + captures[1]64 })65 Docsvisionmediabefore adoption9f06b11
line 66why, one step back66POST /user/:idMarkdownvisionmediabefore adoptionfa08323
lines 67–73why, one step back67 68 post('user/:id', function(){69 User.destroy(params('id')) ? 70 'User deleted' :71 'Failed to delete user'72 })73 Docsvisionmediabefore adoption9f06b11
line 74why, one step back74GET /loginMarkdownvisionmediabefore adoptionfa08323
lines 75–83why, one step back75 76 get('login', function() {77 '<form method="post" action="/login"> \78 <input type="text" name="user[name]" /> \79 <input type="password" name="user[pass]" /> \80 <input type="submit" value="Login"/> \81 </form>'82 })83 Docsvisionmediabefore adoption9f06b11
line 84why, one step back84POST /loginMarkdownvisionmediabefore adoptionfa08323
lines 85–102why, one step back85 86 post('login', function() {87 'Welcome ' + param('user').name88 })89 90## Settings9192 * basepath : defaults to '/'93 * defaultRoute : responds with page not found94 * mime.defaultType : defaults to 'application/octet-stream'95 * cookie.maxAge : defaults to 3600 milliseconds96 97## Public API9899 * Coming Soon100 101## Testing102updated readme to mention jspec versioncsausdevbefore adoptionb51d743
line 103why, one step back103Install [JSpec](http://jspec.info) - note that this currently requires version jspec-2.11.2 (later versions do not work yet), edit the path to JSpec (in spec/spec.node.js) on your machine, and run:Markdownvisionmediabefore adoptionfa08323
lines 104–105why, one step back104105 $ node spec/spec.node.jsAmended readme for running individual specscsausdevbefore adoption0a911dd
lines 106–111why, one step back106 107Run individual tests files:108109 $ node spec/spec.node.js core110 111Will run the tests in spec/spec.core.js only.Link to Mojo mustache templatesvisionmediabefore adoptionfde2bfc
lines 112–115why, one step back112 113## More Information114115 * [Mojo](http://github.com/visionmedia/mojo) JavaScript Mustache TemplatesMarkdownvisionmediabefore adoptionfa08323
lines 116–140why, one step back116117## License 118119(The MIT License)120121Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>122123Permission is hereby granted, free of charge, to any person obtaining124a copy of this software and associated documentation files (the125'Software'), to deal in the Software without restriction, including126without limitation the rights to use, copy, modify, merge, publish,127distribute, sublicense, and/or sell copies of the Software, and to128permit persons to whom the Software is furnished to do so, subject to129the following conditions:130131The above copyright notice and this permission notice shall be132included in all copies or substantial portions of the Software.133134THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,135EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF136MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.137IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY138CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,139TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE140SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.