1 | [](http://expressjs.com/)
|
---|
2 |
|
---|
3 | Fast, unopinionated, minimalist web framework for [Node.js](http://nodejs.org).
|
---|
4 |
|
---|
5 | [![NPM Version][npm-version-image]][npm-url]
|
---|
6 | [![NPM Install Size][npm-install-size-image]][npm-install-size-url]
|
---|
7 | [![NPM Downloads][npm-downloads-image]][npm-downloads-url]
|
---|
8 |
|
---|
9 | ```js
|
---|
10 | const express = require('express')
|
---|
11 | const app = express()
|
---|
12 |
|
---|
13 | app.get('/', function (req, res) {
|
---|
14 | res.send('Hello World')
|
---|
15 | })
|
---|
16 |
|
---|
17 | app.listen(3000)
|
---|
18 | ```
|
---|
19 |
|
---|
20 | ## Installation
|
---|
21 |
|
---|
22 | This is a [Node.js](https://nodejs.org/en/) module available through the
|
---|
23 | [npm registry](https://www.npmjs.com/).
|
---|
24 |
|
---|
25 | Before installing, [download and install Node.js](https://nodejs.org/en/download/).
|
---|
26 | Node.js 0.10 or higher is required.
|
---|
27 |
|
---|
28 | If this is a brand new project, make sure to create a `package.json` first with
|
---|
29 | the [`npm init` command](https://docs.npmjs.com/creating-a-package-json-file).
|
---|
30 |
|
---|
31 | Installation is done using the
|
---|
32 | [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
---|
33 |
|
---|
34 | ```console
|
---|
35 | $ npm install express
|
---|
36 | ```
|
---|
37 |
|
---|
38 | Follow [our installing guide](http://expressjs.com/en/starter/installing.html)
|
---|
39 | for more information.
|
---|
40 |
|
---|
41 | ## Features
|
---|
42 |
|
---|
43 | * Robust routing
|
---|
44 | * Focus on high performance
|
---|
45 | * Super-high test coverage
|
---|
46 | * HTTP helpers (redirection, caching, etc)
|
---|
47 | * View system supporting 14+ template engines
|
---|
48 | * Content negotiation
|
---|
49 | * Executable for generating applications quickly
|
---|
50 |
|
---|
51 | ## Docs & Community
|
---|
52 |
|
---|
53 | * [Website and Documentation](http://expressjs.com/) - [[website repo](https://github.com/expressjs/expressjs.com)]
|
---|
54 | * [#express](https://web.libera.chat/#express) on [Libera Chat](https://libera.chat) IRC
|
---|
55 | * [GitHub Organization](https://github.com/expressjs) for Official Middleware & Modules
|
---|
56 | * Visit the [Wiki](https://github.com/expressjs/express/wiki)
|
---|
57 | * [Google Group](https://groups.google.com/group/express-js) for discussion
|
---|
58 | * [Gitter](https://gitter.im/expressjs/express) for support and discussion
|
---|
59 |
|
---|
60 | **PROTIP** Be sure to read [Migrating from 3.x to 4.x](https://github.com/expressjs/express/wiki/Migrating-from-3.x-to-4.x) as well as [New features in 4.x](https://github.com/expressjs/express/wiki/New-features-in-4.x).
|
---|
61 |
|
---|
62 | ## Quick Start
|
---|
63 |
|
---|
64 | 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:
|
---|
65 |
|
---|
66 | Install the executable. The executable's major version will match Express's:
|
---|
67 |
|
---|
68 | ```console
|
---|
69 | $ npm install -g express-generator@4
|
---|
70 | ```
|
---|
71 |
|
---|
72 | Create the app:
|
---|
73 |
|
---|
74 | ```console
|
---|
75 | $ express /tmp/foo && cd /tmp/foo
|
---|
76 | ```
|
---|
77 |
|
---|
78 | Install dependencies:
|
---|
79 |
|
---|
80 | ```console
|
---|
81 | $ npm install
|
---|
82 | ```
|
---|
83 |
|
---|
84 | Start the server:
|
---|
85 |
|
---|
86 | ```console
|
---|
87 | $ npm start
|
---|
88 | ```
|
---|
89 |
|
---|
90 | View the website at: http://localhost:3000
|
---|
91 |
|
---|
92 | ## Philosophy
|
---|
93 |
|
---|
94 | The Express philosophy is to provide small, robust tooling for HTTP servers, making
|
---|
95 | it a great solution for single page applications, websites, hybrids, or public
|
---|
96 | HTTP APIs.
|
---|
97 |
|
---|
98 | Express does not force you to use any specific ORM or template engine. With support for over
|
---|
99 | 14 template engines via [Consolidate.js](https://github.com/tj/consolidate.js),
|
---|
100 | you can quickly craft your perfect framework.
|
---|
101 |
|
---|
102 | ## Examples
|
---|
103 |
|
---|
104 | To view the examples, clone the Express repo and install the dependencies:
|
---|
105 |
|
---|
106 | ```console
|
---|
107 | $ git clone git://github.com/expressjs/express.git --depth 1
|
---|
108 | $ cd express
|
---|
109 | $ npm install
|
---|
110 | ```
|
---|
111 |
|
---|
112 | Then run whichever example you want:
|
---|
113 |
|
---|
114 | ```console
|
---|
115 | $ node examples/content-negotiation
|
---|
116 | ```
|
---|
117 |
|
---|
118 | ## Contributing
|
---|
119 |
|
---|
120 | [![Linux Build][github-actions-ci-image]][github-actions-ci-url]
|
---|
121 | [![Windows Build][appveyor-image]][appveyor-url]
|
---|
122 | [![Test Coverage][coveralls-image]][coveralls-url]
|
---|
123 |
|
---|
124 | The Express.js project welcomes all constructive contributions. Contributions take many forms,
|
---|
125 | from code for bug fixes and enhancements, to additions and fixes to documentation, additional
|
---|
126 | tests, triaging incoming pull requests and issues, and more!
|
---|
127 |
|
---|
128 | See the [Contributing Guide](Contributing.md) for more technical details on contributing.
|
---|
129 |
|
---|
130 | ### Security Issues
|
---|
131 |
|
---|
132 | If you discover a security vulnerability in Express, please see [Security Policies and Procedures](Security.md).
|
---|
133 |
|
---|
134 | ### Running Tests
|
---|
135 |
|
---|
136 | To run the test suite, first install the dependencies, then run `npm test`:
|
---|
137 |
|
---|
138 | ```console
|
---|
139 | $ npm install
|
---|
140 | $ npm test
|
---|
141 | ```
|
---|
142 |
|
---|
143 | ## People
|
---|
144 |
|
---|
145 | The original author of Express is [TJ Holowaychuk](https://github.com/tj)
|
---|
146 |
|
---|
147 | The current lead maintainer is [Douglas Christopher Wilson](https://github.com/dougwilson)
|
---|
148 |
|
---|
149 | [List of all contributors](https://github.com/expressjs/express/graphs/contributors)
|
---|
150 |
|
---|
151 | ## License
|
---|
152 |
|
---|
153 | [MIT](LICENSE)
|
---|
154 |
|
---|
155 | [appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/express/master?label=windows
|
---|
156 | [appveyor-url]: https://ci.appveyor.com/project/dougwilson/express
|
---|
157 | [coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/express/master
|
---|
158 | [coveralls-url]: https://coveralls.io/r/expressjs/express?branch=master
|
---|
159 | [github-actions-ci-image]: https://badgen.net/github/checks/expressjs/express/master?label=linux
|
---|
160 | [github-actions-ci-url]: https://github.com/expressjs/express/actions/workflows/ci.yml
|
---|
161 | [npm-downloads-image]: https://badgen.net/npm/dm/express
|
---|
162 | [npm-downloads-url]: https://npmcharts.com/compare/express?minimal=true
|
---|
163 | [npm-install-size-image]: https://badgen.net/packagephobia/install/express
|
---|
164 | [npm-install-size-url]: https://packagephobia.com/result?p=express
|
---|
165 | [npm-url]: https://npmjs.org/package/express
|
---|
166 | [npm-version-image]: https://badgen.net/npm/v/express
|
---|