Skip to content
Myr

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 file

Take it

Markdownvisionmediabefore adoptionfa08323

lines 1–4why, one step back
1
2# Express34 Insanely fast (and small) server-side JavaScript web development framework

Docsvisionmediabefore adoption9f06b11

line 5why, one step back
5 built on **node.js** and the **V8 JavaScript engine**.

Markdownvisionmediabefore adoptionfa08323

lines 6–29why, one step back
6
7 * 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 back
30## Limitations
3132Note 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.36

Markdownvisionmediabefore adoptionfa08323

lines 37–40why, one step back
37## Performance
3839 Extensive benchmarking will wait until a development version40 has been released. However for simple an average route and response

Docsvisionmediabefore adoption9f06b11

lines 41–42why, one step back
41 body Ruby's Sinatra scored **1454** request per second using Thin, while
42 Express scored **2762**.

Markdownvisionmediabefore adoptionfa08323

lines 43–44why, one step back
43
44## Examples

Added example, extra info to Readmecsausdevbefore adoption3491ff3

line 45why, one step back
45

Amended readme for running individual specscsausdevbefore adoption0a911dd

line 46why, one step back
46See examples/simple.js for a working server. Just type "node examples/simple.js" and then go to http://localhost:3000/hello/world

Markdownvisionmediabefore adoptionfa08323

line 47why, one step back
47

Docsvisionmediabefore adoption9f06b11

line 48why, one step back
48GET /user/tj/edit

Markdownvisionmediabefore adoptionfa08323

lines 49–53why, one step back
49
50 get('user/:name/:operation', function(){51 param('operation') + 'ing ' + param('name')52 })53

Docsvisionmediabefore adoption9f06b11

line 54why, one step back
54GET /articles

Markdownvisionmediabefore adoptionfa08323

lines 55–59why, one step back
55
56 get('articles', function(){57 'list of articles'58 })59

Docsvisionmediabefore adoption9f06b11

line 60why, one step back
60GET /articles/12

Markdownvisionmediabefore adoptionfa08323

lines 61–65why, one step back
61
62 get(/articles\/(\d+)/, function(){63 'article id ' + captures[1]64 })65

Docsvisionmediabefore adoption9f06b11

line 66why, one step back
66POST /user/:id

Markdownvisionmediabefore adoptionfa08323

lines 67–73why, one step back
67
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 back
74GET /login

Markdownvisionmediabefore adoptionfa08323

lines 75–83why, one step back
75
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 back
84POST /login

Markdownvisionmediabefore adoptionfa08323

lines 85–102why, one step back
85
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## Testing102

updated readme to mention jspec versioncsausdevbefore adoptionb51d743

line 103why, one step back
103Install [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 back
104
105 $ node spec/spec.node.js

Amended readme for running individual specscsausdevbefore adoption0a911dd

lines 106–111why, one step back
106
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 back
112
113## More Information114115 * [Mojo](http://github.com/visionmedia/mojo) JavaScript Mustache Templates

Markdownvisionmediabefore adoptionfa08323

lines 116–140why, one step back
116
117## 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.