| rev |
line source |
|
seanhalle@5
|
1 [](https://expressjs.com/)
|
|
seanhalle@5
|
2
|
|
seanhalle@5
|
3 Fast, unopinionated, minimalist web framework for [node](http://nodejs.org).
|
|
seanhalle@5
|
4
|
|
seanhalle@5
|
5 [](https://badge.fury.io/js/express)
|
|
seanhalle@5
|
6 [](https://travis-ci.org/visionmedia/express)
|
|
seanhalle@5
|
7 [](https://coveralls.io/r/visionmedia/express)
|
|
seanhalle@5
|
8 [](https://www.gittip.com/dougwilson/)
|
|
seanhalle@5
|
9
|
|
seanhalle@5
|
10 ```js
|
|
seanhalle@5
|
11 var express = require('express')
|
|
seanhalle@5
|
12 var app = express()
|
|
seanhalle@5
|
13
|
|
seanhalle@5
|
14 app.get('/', function (req, res) {
|
|
seanhalle@5
|
15 res.send('Hello World')
|
|
seanhalle@5
|
16 })
|
|
seanhalle@5
|
17
|
|
seanhalle@5
|
18 app.listen(3000)
|
|
seanhalle@5
|
19 ```
|
|
seanhalle@5
|
20
|
|
seanhalle@5
|
21 **PROTIP** Be sure to read [Migrating from 3.x to 4.x](https://github.com/visionmedia/express/wiki/Migrating-from-3.x-to-4.x) as well as [New features in 4.x](https://github.com/visionmedia/express/wiki/New-features-in-4.x).
|
|
seanhalle@5
|
22
|
|
seanhalle@5
|
23 ### Installation
|
|
seanhalle@5
|
24
|
|
seanhalle@5
|
25 ```bash
|
|
seanhalle@5
|
26 $ npm install express
|
|
seanhalle@5
|
27 ```
|
|
seanhalle@5
|
28
|
|
seanhalle@5
|
29 ## Quick Start
|
|
seanhalle@5
|
30
|
|
seanhalle@5
|
31 The quickest way to get started with express is to utilize the executable [`express(1)`](https://github.com/expressjs/generator) to generate an application as shown below:
|
|
seanhalle@5
|
32
|
|
seanhalle@5
|
33 Install the executable. The executable's major version will match Express's:
|
|
seanhalle@5
|
34
|
|
seanhalle@5
|
35 ```bash
|
|
seanhalle@5
|
36 $ npm install -g express-generator@4
|
|
seanhalle@5
|
37 ```
|
|
seanhalle@5
|
38
|
|
seanhalle@5
|
39 Create the app:
|
|
seanhalle@5
|
40
|
|
seanhalle@5
|
41 ```bash
|
|
seanhalle@5
|
42 $ express /tmp/foo && cd /tmp/foo
|
|
seanhalle@5
|
43 ```
|
|
seanhalle@5
|
44
|
|
seanhalle@5
|
45 Install dependencies:
|
|
seanhalle@5
|
46
|
|
seanhalle@5
|
47 ```bash
|
|
seanhalle@5
|
48 $ npm install
|
|
seanhalle@5
|
49 ```
|
|
seanhalle@5
|
50
|
|
seanhalle@5
|
51 Start the server:
|
|
seanhalle@5
|
52
|
|
seanhalle@5
|
53 ```bash
|
|
seanhalle@5
|
54 $ npm start
|
|
seanhalle@5
|
55 ```
|
|
seanhalle@5
|
56
|
|
seanhalle@5
|
57 ## Features
|
|
seanhalle@5
|
58
|
|
seanhalle@5
|
59 * Robust routing
|
|
seanhalle@5
|
60 * HTTP helpers (redirection, caching, etc)
|
|
seanhalle@5
|
61 * View system supporting 14+ template engines
|
|
seanhalle@5
|
62 * Content negotiation
|
|
seanhalle@5
|
63 * Focus on high performance
|
|
seanhalle@5
|
64 * Executable for generating applications quickly
|
|
seanhalle@5
|
65 * High test coverage
|
|
seanhalle@5
|
66
|
|
seanhalle@5
|
67 ## Philosophy
|
|
seanhalle@5
|
68
|
|
seanhalle@5
|
69 The Express philosophy is to provide small, robust tooling for HTTP servers, making
|
|
seanhalle@5
|
70 it a great solution for single page applications, web sites, hybrids, or public
|
|
seanhalle@5
|
71 HTTP APIs.
|
|
seanhalle@5
|
72
|
|
seanhalle@5
|
73 Express does not force you to use any specific ORM or template engine. With support for over
|
|
seanhalle@5
|
74 14 template engines via [Consolidate.js](https://github.com/visionmedia/consolidate.js),
|
|
seanhalle@5
|
75 you can quickly craft your perfect framework.
|
|
seanhalle@5
|
76
|
|
seanhalle@5
|
77 ## More Information
|
|
seanhalle@5
|
78
|
|
seanhalle@5
|
79 * [Website and Documentation](http://expressjs.com/) - [[website repo](https://github.com/visionmedia/expressjs.com)]
|
|
seanhalle@5
|
80 * [Github Organization](https://github.com/expressjs) for Official Middleware & Modules
|
|
seanhalle@5
|
81 * [#express](https://webchat.freenode.net/?channels=express) on freenode IRC
|
|
seanhalle@5
|
82 * Visit the [Wiki](https://github.com/visionmedia/express/wiki)
|
|
seanhalle@5
|
83 * [Google Group](https://groups.google.com/group/express-js) for discussion
|
|
seanhalle@5
|
84 * [Русскоязычная документация](http://jsman.ru/express/)
|
|
seanhalle@5
|
85 * [한국어 문서](http://expressjs.kr) - [[website repo](https://github.com/Hanul/expressjs.kr)]
|
|
seanhalle@5
|
86 * Run express examples [online](https://runnable.com/express)
|
|
seanhalle@5
|
87
|
|
seanhalle@5
|
88 ## Viewing Examples
|
|
seanhalle@5
|
89
|
|
seanhalle@5
|
90 Clone the Express repo, then install the dev dependencies to install all the example / test suite dependencies:
|
|
seanhalle@5
|
91
|
|
seanhalle@5
|
92 ```bash
|
|
seanhalle@5
|
93 $ git clone git://github.com/visionmedia/express.git --depth 1
|
|
seanhalle@5
|
94 $ cd express
|
|
seanhalle@5
|
95 $ npm install
|
|
seanhalle@5
|
96 ```
|
|
seanhalle@5
|
97
|
|
seanhalle@5
|
98 Then run whichever example you want:
|
|
seanhalle@5
|
99
|
|
seanhalle@5
|
100 $ node examples/content-negotiation
|
|
seanhalle@5
|
101
|
|
seanhalle@5
|
102 You can also view live examples here:
|
|
seanhalle@5
|
103
|
|
seanhalle@5
|
104 <a href="https://runnable.com/express" target="_blank"><img src="https://runnable.com/external/styles/assets/runnablebtn.png" style="width:67px;height:25px;"></a>
|
|
seanhalle@5
|
105
|
|
seanhalle@5
|
106 ## Running Tests
|
|
seanhalle@5
|
107
|
|
seanhalle@5
|
108 To run the test suite, first invoke the following command within the repo, installing the development dependencies:
|
|
seanhalle@5
|
109
|
|
seanhalle@5
|
110 ```bash
|
|
seanhalle@5
|
111 $ npm install
|
|
seanhalle@5
|
112 ```
|
|
seanhalle@5
|
113
|
|
seanhalle@5
|
114 Then run the tests:
|
|
seanhalle@5
|
115
|
|
seanhalle@5
|
116 ```bash
|
|
seanhalle@5
|
117 $ npm test
|
|
seanhalle@5
|
118 ```
|
|
seanhalle@5
|
119
|
|
seanhalle@5
|
120 ### Contributors
|
|
seanhalle@5
|
121
|
|
seanhalle@5
|
122 * Author: [TJ Holowaychuk](https://github.com/visionmedia)
|
|
seanhalle@5
|
123 * Lead Maintainer: [Douglas Christopher Wilson](https://github.com/dougwilson)
|
|
seanhalle@5
|
124 * [All Contributors](https://github.com/visionmedia/express/graphs/contributors)
|
|
seanhalle@5
|
125
|
|
seanhalle@5
|
126 ### License
|
|
seanhalle@5
|
127
|
|
seanhalle@5
|
128 [MIT](LICENSE)
|