Skip to content
Myr

Readme.md

This file

Path

Readme.md

141 lines · 3.8 KiB · Markdown

Last changed by

Merge branch 'master' of git://github.com/csausdev/express into devvisionmediabefore adoption33ea221

History of this file

Take it

Markdownvisionmediabefore adoptionfa08323

line 1why, one step back
1

No more ASCII artvisionmediabefore adoptionbf03e85

lines 2–3why, one step back
2# Express
3

Markdownvisionmediabefore adoptionfa08323

line 4why, one step back
4 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

line 39why, one step back
39See examples/simple.js for a working server that uses a synchronous handler.

Merge branch 'master' of git://github.com/csausdev/express into devvisionmediabefore adoption33ea221

lines 40–42why, one step back
40Just type "node examples/simple.js" and then go to http://localhost:3000/i/like/cheese
4142For an asynchronous example, run "node examples/async.js" and then go to http://localhost:3000/wait/2000

Markdownvisionmediabefore adoptionfa08323

line 43why, one step back
43

Docsvisionmediabefore adoption9f06b11

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

Markdownvisionmediabefore adoptionfa08323

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

Docsvisionmediabefore adoption9f06b11

line 50why, one step back
50GET /articles

Markdownvisionmediabefore adoptionfa08323

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

Docsvisionmediabefore adoption9f06b11

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

Markdownvisionmediabefore adoptionfa08323

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

Docsvisionmediabefore adoption9f06b11

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

Markdownvisionmediabefore adoptionfa08323

lines 63–69why, one step back
63
64 post('user/:id', function(){65 User.destroy(params('id')) ? 66 'User deleted' :67 'Failed to delete user'68 })69

Docsvisionmediabefore adoption9f06b11

line 70why, one step back
70GET /login

Markdownvisionmediabefore adoptionfa08323

lines 71–79why, one step back
71
72 get('login', function() {73 '<form method="post" action="/login"> \74 <input type="text" name="user[name]" /> \75 <input type="password" name="user[pass]" /> \76 <input type="submit" value="Login"/> \77 </form>'78 })79

Docsvisionmediabefore adoption9f06b11

line 80why, one step back
80POST /login

Markdownvisionmediabefore adoptionfa08323

lines 81–96why, one step back
81
82 post('login', function() {83 'Welcome ' + param('user').name84 })85 86## Settings8788 * basepath : defaults to '/'89 * defaultRoute : responds with page not found90 * mime.defaultType : defaults to 'application/octet-stream'91 * cookie.maxAge : defaults to 3600 milliseconds92 93## Public API9495 * Coming Soon96

Readme for testingvisionmediabefore adoption34a55ba

lines 97–101why, one step back
97## Running Tests
9899Express uses the [JSpec](http://jspec.info) BDD JavaScript testing100framework to write and run elegant spec suites. JSpec is froozen 101to spec/lib and does not require seperate installation.

Markdownvisionmediabefore adoptionfa08323

line 102why, one step back
102

Updated readme with new spec running infovisionmediabefore adoption8e23ebb

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

Markdownvisionmediabefore adoptionfa08323

line 104why, one step back
104

Updated readme with new spec running infovisionmediabefore adoption8e23ebb

line 105why, one step back
105 $ make test

Amended readme for running individual specscsausdevbefore adoption7459e7d

line 106why, one step back
106

Updated readme with new spec running infovisionmediabefore adoption8e23ebb

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

Amended readme for running individual specscsausdevbefore adoption7459e7d

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

Updated readme with new spec running infovisionmediabefore adoption8e23ebb

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

Link to Mojo mustache templatesvisionmediabefore adoptionfde2bfc

lines 113–116why, one step back
113
114## More Information115116 * [Mojo](http://github.com/visionmedia/mojo) JavaScript Mustache Templates

Markdownvisionmediabefore adoptionfa08323

lines 117–141why, one step back
117
118## License 119120(The MIT License)121122Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>123124Permission is hereby granted, free of charge, to any person obtaining125a copy of this software and associated documentation files (the126'Software'), to deal in the Software without restriction, including127without limitation the rights to use, copy, modify, merge, publish,128distribute, sublicense, and/or sell copies of the Software, and to129permit persons to whom the Software is furnished to do so, subject to130the following conditions:131132The above copyright notice and this permission notice shall be133included in all copies or substantial portions of the Software.134135THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,136EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF137MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.138IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY139CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,140TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE141SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.