Skip to content
Myr

Readme.md

This file

Path

Readme.md

140 lines · 3.8 KiB · Markdown

Last changed by

Readme for testingvisionmediabefore adoption34a55ba

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–28why, 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 * etc

Added example, extra info to Readmecsausdevbefore adoption9973bd7

line 29why, one step back
29

Markdownvisionmediabefore adoptionfa08323

lines 30–33why, one step back
30## Performance
3132 Extensive benchmarking will wait until a development version33 has been released. However for simple an average route and response

Docsvisionmediabefore adoption9f06b11

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

Markdownvisionmediabefore adoptionfa08323

lines 36–37why, one step back
36
37## Examples

Added example, extra info to Readmecsausdevbefore adoption9973bd7

line 38why, one step back
38

Asynchronous handlers working.csausdevbefore adoption4858502

lines 39–41why, one step back
39See 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/2000

Markdownvisionmediabefore adoptionfa08323

line 42why, one step back
42

Docsvisionmediabefore adoption9f06b11

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

Markdownvisionmediabefore adoptionfa08323

lines 44–48why, one step back
44
45 get('user/:name/:operation', function(){46 param('operation') + 'ing ' + param('name')47 })48

Docsvisionmediabefore adoption9f06b11

line 49why, one step back
49GET /articles

Markdownvisionmediabefore adoptionfa08323

lines 50–54why, one step back
50
51 get('articles', function(){52 'list of articles'53 })54

Docsvisionmediabefore adoption9f06b11

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

Markdownvisionmediabefore adoptionfa08323

lines 56–60why, one step back
56
57 get(/articles\/(\d+)/, function(){58 'article id ' + captures[1]59 })60

Docsvisionmediabefore adoption9f06b11

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

Markdownvisionmediabefore adoptionfa08323

lines 62–68why, one step back
62
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 back
69GET /login

Markdownvisionmediabefore adoptionfa08323

lines 70–78why, one step back
70
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 back
79POST /login

Markdownvisionmediabefore adoptionfa08323

lines 80–95why, one step back
80
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 back
96## Running Tests
9798Express 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 back
101

Updated readme with new spec running infovisionmediabefore adoption8e23ebb

line 102why, one step back
102To run all specifications:

Markdownvisionmediabefore adoptionfa08323

line 103why, one step back
103

Updated readme with new spec running infovisionmediabefore adoption8e23ebb

line 104why, one step back
104 $ make test

Amended readme for running individual specscsausdevbefore adoption7459e7d

line 105why, one step back
105

Updated readme with new spec running infovisionmediabefore adoption8e23ebb

line 106why, one step back
106Run individual suites:

Amended readme for running individual specscsausdevbefore adoption7459e7d

lines 107–108why, one step back
107
108 $ node spec/spec.node.js core

Updated readme with new spec running infovisionmediabefore adoption8e23ebb

lines 109–111why, one step back
109 $ node spec/spec.node.js mime
110 $ node spec/spec.node.js routing111 ...

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.