Readme.md
This file
Path
Readme.md
140 lines · 3.8 KiB · Markdown
Last changed by
Readme for testingvisionmediabefore adoption34a55ba
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–28why, 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 * etcAdded example, extra info to Readmecsausdevbefore adoption9973bd7
line 29why, one step back29Markdownvisionmediabefore adoptionfa08323
lines 30–33why, one step back30## Performance3132 Extensive benchmarking will wait until a development version33 has been released. However for simple an average route and responseDocsvisionmediabefore adoption9f06b11
lines 34–35why, one step back34 body Ruby's Sinatra scored **1454** request per second using Thin, while35 Express scored **2762**.Markdownvisionmediabefore adoptionfa08323
lines 36–37why, one step back3637## ExamplesAdded example, extra info to Readmecsausdevbefore adoption9973bd7
line 38why, one step back38Asynchronous handlers working.csausdevbefore adoption4858502
lines 39–41why, one step back39See examples/simple.js for a working server that uses a synchronous handler. 40Just type "node examples/simple.js" and then go to http://localhost:3000/hello/world41For an asynchronous example, run "node examples/async.js" and then go to http://localhost:3000/hello/world/2000Markdownvisionmediabefore adoptionfa08323
line 42why, one step back42Docsvisionmediabefore adoption9f06b11
line 43why, one step back43GET /user/tj/editMarkdownvisionmediabefore adoptionfa08323
lines 44–48why, one step back44 45 get('user/:name/:operation', function(){46 param('operation') + 'ing ' + param('name')47 })48Docsvisionmediabefore adoption9f06b11
line 49why, one step back49GET /articlesMarkdownvisionmediabefore adoptionfa08323
lines 50–54why, one step back50 51 get('articles', function(){52 'list of articles'53 })54Docsvisionmediabefore adoption9f06b11
line 55why, one step back55GET /articles/12Markdownvisionmediabefore adoptionfa08323
lines 56–60why, one step back56 57 get(/articles\/(\d+)/, function(){58 'article id ' + captures[1]59 })60 Docsvisionmediabefore adoption9f06b11
line 61why, one step back61POST /user/:idMarkdownvisionmediabefore adoptionfa08323
lines 62–68why, one step back62 63 post('user/:id', function(){64 User.destroy(params('id')) ? 65 'User deleted' :66 'Failed to delete user'67 })68 Docsvisionmediabefore adoption9f06b11
line 69why, one step back69GET /loginMarkdownvisionmediabefore adoptionfa08323
lines 70–78why, one step back70 71 get('login', function() {72 '<form method="post" action="/login"> \73 <input type="text" name="user[name]" /> \74 <input type="password" name="user[pass]" /> \75 <input type="submit" value="Login"/> \76 </form>'77 })78 Docsvisionmediabefore adoption9f06b11
line 79why, one step back79POST /loginMarkdownvisionmediabefore adoptionfa08323
lines 80–95why, one step back80 81 post('login', function() {82 'Welcome ' + param('user').name83 })84 85## Settings8687 * basepath : defaults to '/'88 * defaultRoute : responds with page not found89 * mime.defaultType : defaults to 'application/octet-stream'90 * cookie.maxAge : defaults to 3600 milliseconds91 92## Public API9394 * Coming Soon95 Readme for testingvisionmediabefore adoption34a55ba
lines 96–100why, one step back96## Running Tests9798Express uses the [JSpec](http://jspec.info) BDD JavaScript testing99framework to write and run elegant spec suites. JSpec is froozen 100to spec/lib and does not require seperate installation.Markdownvisionmediabefore adoptionfa08323
line 101why, one step back101Updated readme with new spec running infovisionmediabefore adoption8e23ebb
line 102why, one step back102To run all specifications:Markdownvisionmediabefore adoptionfa08323
line 103why, one step back103Updated readme with new spec running infovisionmediabefore adoption8e23ebb
line 104why, one step back104 $ make testAmended readme for running individual specscsausdevbefore adoption7459e7d
line 105why, one step back105 Updated readme with new spec running infovisionmediabefore adoption8e23ebb
line 106why, one step back106Run individual suites:Amended readme for running individual specscsausdevbefore adoption7459e7d
lines 107–108why, one step back107108 $ node spec/spec.node.js coreUpdated readme with new spec running infovisionmediabefore adoption8e23ebb
lines 109–111why, one step back109 $ node spec/spec.node.js mime110 $ node spec/spec.node.js routing111 ...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.