| 1 | [](http://expressjs.com/)
|
|---|
| 2 |
|
|---|
| 3 | **Fast, unopinionated, minimalist web framework for [Node.js](http://nodejs.org).**
|
|---|
| 4 |
|
|---|
| 5 | **This project has a [Code of Conduct][].**
|
|---|
| 6 |
|
|---|
| 7 | ## Table of contents
|
|---|
| 8 |
|
|---|
| 9 | * [Installation](#Installation)
|
|---|
| 10 | * [Features](#Features)
|
|---|
| 11 | * [Docs & Community](#docs--community)
|
|---|
| 12 | * [Quick Start](#Quick-Start)
|
|---|
| 13 | * [Running Tests](#Running-Tests)
|
|---|
| 14 | * [Philosophy](#Philosophy)
|
|---|
| 15 | * [Examples](#Examples)
|
|---|
| 16 | * [Contributing to Express](#Contributing)
|
|---|
| 17 | * [TC (Technical Committee)](#tc-technical-committee)
|
|---|
| 18 | * [Triagers](#triagers)
|
|---|
| 19 | * [License](#license)
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 | [![NPM Version][npm-version-image]][npm-url]
|
|---|
| 23 | [![NPM Install Size][npm-install-size-image]][npm-install-size-url]
|
|---|
| 24 | [![NPM Downloads][npm-downloads-image]][npm-downloads-url]
|
|---|
| 25 | [![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer]
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 | ```js
|
|---|
| 29 | const express = require('express')
|
|---|
| 30 | const app = express()
|
|---|
| 31 |
|
|---|
| 32 | app.get('/', function (req, res) {
|
|---|
| 33 | res.send('Hello World')
|
|---|
| 34 | })
|
|---|
| 35 |
|
|---|
| 36 | app.listen(3000)
|
|---|
| 37 | ```
|
|---|
| 38 |
|
|---|
| 39 | ## Installation
|
|---|
| 40 |
|
|---|
| 41 | This is a [Node.js](https://nodejs.org/en/) module available through the
|
|---|
| 42 | [npm registry](https://www.npmjs.com/).
|
|---|
| 43 |
|
|---|
| 44 | Before installing, [download and install Node.js](https://nodejs.org/en/download/).
|
|---|
| 45 | Node.js 0.10 or higher is required.
|
|---|
| 46 |
|
|---|
| 47 | If this is a brand new project, make sure to create a `package.json` first with
|
|---|
| 48 | the [`npm init` command](https://docs.npmjs.com/creating-a-package-json-file).
|
|---|
| 49 |
|
|---|
| 50 | Installation is done using the
|
|---|
| 51 | [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
|---|
| 52 |
|
|---|
| 53 | ```console
|
|---|
| 54 | $ npm install express
|
|---|
| 55 | ```
|
|---|
| 56 |
|
|---|
| 57 | Follow [our installing guide](http://expressjs.com/en/starter/installing.html)
|
|---|
| 58 | for more information.
|
|---|
| 59 |
|
|---|
| 60 | ## Features
|
|---|
| 61 |
|
|---|
| 62 | * Robust routing
|
|---|
| 63 | * Focus on high performance
|
|---|
| 64 | * Super-high test coverage
|
|---|
| 65 | * HTTP helpers (redirection, caching, etc)
|
|---|
| 66 | * View system supporting 14+ template engines
|
|---|
| 67 | * Content negotiation
|
|---|
| 68 | * Executable for generating applications quickly
|
|---|
| 69 |
|
|---|
| 70 | ## Docs & Community
|
|---|
| 71 |
|
|---|
| 72 | * [Website and Documentation](http://expressjs.com/) - [[website repo](https://github.com/expressjs/expressjs.com)]
|
|---|
| 73 | * [#express](https://web.libera.chat/#express) on [Libera Chat](https://libera.chat) IRC
|
|---|
| 74 | * [GitHub Organization](https://github.com/expressjs) for Official Middleware & Modules
|
|---|
| 75 | * Visit the [Wiki](https://github.com/expressjs/express/wiki)
|
|---|
| 76 | * [Google Group](https://groups.google.com/group/express-js) for discussion
|
|---|
| 77 | * [Gitter](https://gitter.im/expressjs/express) for support and discussion
|
|---|
| 78 |
|
|---|
| 79 | **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).
|
|---|
| 80 |
|
|---|
| 81 | ## Quick Start
|
|---|
| 82 |
|
|---|
| 83 | 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:
|
|---|
| 84 |
|
|---|
| 85 | Install the executable. The executable's major version will match Express's:
|
|---|
| 86 |
|
|---|
| 87 | ```console
|
|---|
| 88 | $ npm install -g express-generator@4
|
|---|
| 89 | ```
|
|---|
| 90 |
|
|---|
| 91 | Create the app:
|
|---|
| 92 |
|
|---|
| 93 | ```console
|
|---|
| 94 | $ express /tmp/foo && cd /tmp/foo
|
|---|
| 95 | ```
|
|---|
| 96 |
|
|---|
| 97 | Install dependencies:
|
|---|
| 98 |
|
|---|
| 99 | ```console
|
|---|
| 100 | $ npm install
|
|---|
| 101 | ```
|
|---|
| 102 |
|
|---|
| 103 | Start the server:
|
|---|
| 104 |
|
|---|
| 105 | ```console
|
|---|
| 106 | $ npm start
|
|---|
| 107 | ```
|
|---|
| 108 |
|
|---|
| 109 | View the website at: http://localhost:3000
|
|---|
| 110 |
|
|---|
| 111 | ## Philosophy
|
|---|
| 112 |
|
|---|
| 113 | The Express philosophy is to provide small, robust tooling for HTTP servers, making
|
|---|
| 114 | it a great solution for single page applications, websites, hybrids, or public
|
|---|
| 115 | HTTP APIs.
|
|---|
| 116 |
|
|---|
| 117 | Express does not force you to use any specific ORM or template engine. With support for over
|
|---|
| 118 | 14 template engines via [Consolidate.js](https://github.com/tj/consolidate.js),
|
|---|
| 119 | you can quickly craft your perfect framework.
|
|---|
| 120 |
|
|---|
| 121 | ## Examples
|
|---|
| 122 |
|
|---|
| 123 | To view the examples, clone the Express repo and install the dependencies:
|
|---|
| 124 |
|
|---|
| 125 | ```console
|
|---|
| 126 | $ git clone https://github.com/expressjs/express.git --depth 1
|
|---|
| 127 | $ cd express
|
|---|
| 128 | $ npm install
|
|---|
| 129 | ```
|
|---|
| 130 |
|
|---|
| 131 | Then run whichever example you want:
|
|---|
| 132 |
|
|---|
| 133 | ```console
|
|---|
| 134 | $ node examples/content-negotiation
|
|---|
| 135 | ```
|
|---|
| 136 |
|
|---|
| 137 | ## Contributing
|
|---|
| 138 |
|
|---|
| 139 | [![Linux Build][github-actions-ci-image]][github-actions-ci-url]
|
|---|
| 140 | [![Windows Build][appveyor-image]][appveyor-url]
|
|---|
| 141 | [![Test Coverage][coveralls-image]][coveralls-url]
|
|---|
| 142 |
|
|---|
| 143 | The Express.js project welcomes all constructive contributions. Contributions take many forms,
|
|---|
| 144 | from code for bug fixes and enhancements, to additions and fixes to documentation, additional
|
|---|
| 145 | tests, triaging incoming pull requests and issues, and more!
|
|---|
| 146 |
|
|---|
| 147 | See the [Contributing Guide](Contributing.md) for more technical details on contributing.
|
|---|
| 148 |
|
|---|
| 149 | ### Security Issues
|
|---|
| 150 |
|
|---|
| 151 | If you discover a security vulnerability in Express, please see [Security Policies and Procedures](Security.md).
|
|---|
| 152 |
|
|---|
| 153 | ### Running Tests
|
|---|
| 154 |
|
|---|
| 155 | To run the test suite, first install the dependencies, then run `npm test`:
|
|---|
| 156 |
|
|---|
| 157 | ```console
|
|---|
| 158 | $ npm install
|
|---|
| 159 | $ npm test
|
|---|
| 160 | ```
|
|---|
| 161 |
|
|---|
| 162 | ## People
|
|---|
| 163 |
|
|---|
| 164 | The original author of Express is [TJ Holowaychuk](https://github.com/tj)
|
|---|
| 165 |
|
|---|
| 166 | [List of all contributors](https://github.com/expressjs/express/graphs/contributors)
|
|---|
| 167 |
|
|---|
| 168 | ### TC (Technical Committee)
|
|---|
| 169 |
|
|---|
| 170 | * [UlisesGascon](https://github.com/UlisesGascon) - **Ulises Gascón** (he/him)
|
|---|
| 171 | * [jonchurch](https://github.com/jonchurch) - **Jon Church**
|
|---|
| 172 | * [wesleytodd](https://github.com/wesleytodd) - **Wes Todd**
|
|---|
| 173 | * [LinusU](https://github.com/LinusU) - **Linus Unnebäck**
|
|---|
| 174 | * [blakeembrey](https://github.com/blakeembrey) - **Blake Embrey**
|
|---|
| 175 | * [sheplu](https://github.com/sheplu) - **Jean Burellier**
|
|---|
| 176 | * [crandmck](https://github.com/crandmck) - **Rand McKinney**
|
|---|
| 177 | * [ctcpip](https://github.com/ctcpip) - **Chris de Almeida**
|
|---|
| 178 |
|
|---|
| 179 | <details>
|
|---|
| 180 | <summary>TC emeriti members</summary>
|
|---|
| 181 |
|
|---|
| 182 | #### TC emeriti members
|
|---|
| 183 |
|
|---|
| 184 | * [dougwilson](https://github.com/dougwilson) - **Douglas Wilson**
|
|---|
| 185 | * [hacksparrow](https://github.com/hacksparrow) - **Hage Yaapa**
|
|---|
| 186 | * [jonathanong](https://github.com/jonathanong) - **jongleberry**
|
|---|
| 187 | * [niftylettuce](https://github.com/niftylettuce) - **niftylettuce**
|
|---|
| 188 | * [troygoode](https://github.com/troygoode) - **Troy Goode**
|
|---|
| 189 | </details>
|
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 | ### Triagers
|
|---|
| 193 |
|
|---|
| 194 | * [aravindvnair99](https://github.com/aravindvnair99) - **Aravind Nair**
|
|---|
| 195 | * [carpasse](https://github.com/carpasse) - **Carlos Serrano**
|
|---|
| 196 | * [CBID2](https://github.com/CBID2) - **Christine Belzie**
|
|---|
| 197 | * [enyoghasim](https://github.com/enyoghasim) - **David Enyoghasim**
|
|---|
| 198 | * [UlisesGascon](https://github.com/UlisesGascon) - **Ulises Gascón** (he/him)
|
|---|
| 199 | * [mertcanaltin](https://github.com/mertcanaltin) - **Mert Can Altin**
|
|---|
| 200 | * [0ss](https://github.com/0ss) - **Salah**
|
|---|
| 201 | * [import-brain](https://github.com/import-brain) - **Eric Cheng** (he/him)
|
|---|
| 202 | * [3imed-jaberi](https://github.com/3imed-jaberi) - **Imed Jaberi**
|
|---|
| 203 | * [dakshkhetan](https://github.com/dakshkhetan) - **Daksh Khetan** (he/him)
|
|---|
| 204 | * [lucasraziel](https://github.com/lucasraziel) - **Lucas Soares Do Rego**
|
|---|
| 205 | * [IamLizu](https://github.com/IamLizu) - **S M Mahmudul Hasan** (he/him)
|
|---|
| 206 | * [Sushmeet](https://github.com/Sushmeet) - **Sushmeet Sunger**
|
|---|
| 207 |
|
|---|
| 208 | <details>
|
|---|
| 209 | <summary>Triagers emeriti members</summary>
|
|---|
| 210 |
|
|---|
| 211 | #### Emeritus Triagers
|
|---|
| 212 |
|
|---|
| 213 | * [AuggieH](https://github.com/AuggieH) - **Auggie Hudak**
|
|---|
| 214 | * [G-Rath](https://github.com/G-Rath) - **Gareth Jones**
|
|---|
| 215 | * [MohammadXroid](https://github.com/MohammadXroid) - **Mohammad Ayashi**
|
|---|
| 216 | * [NawafSwe](https://github.com/NawafSwe) - **Nawaf Alsharqi**
|
|---|
| 217 | * [NotMoni](https://github.com/NotMoni) - **Moni**
|
|---|
| 218 | * [VigneshMurugan](https://github.com/VigneshMurugan) - **Vignesh Murugan**
|
|---|
| 219 | * [davidmashe](https://github.com/davidmashe) - **David Ashe**
|
|---|
| 220 | * [digitaIfabric](https://github.com/digitaIfabric) - **David**
|
|---|
| 221 | * [e-l-i-s-e](https://github.com/e-l-i-s-e) - **Elise Bonner**
|
|---|
| 222 | * [fed135](https://github.com/fed135) - **Frederic Charette**
|
|---|
| 223 | * [firmanJS](https://github.com/firmanJS) - **Firman Abdul Hakim**
|
|---|
| 224 | * [getspooky](https://github.com/getspooky) - **Yasser Ameur**
|
|---|
| 225 | * [ghinks](https://github.com/ghinks) - **Glenn**
|
|---|
| 226 | * [ghousemohamed](https://github.com/ghousemohamed) - **Ghouse Mohamed**
|
|---|
| 227 | * [gireeshpunathil](https://github.com/gireeshpunathil) - **Gireesh Punathil**
|
|---|
| 228 | * [jake32321](https://github.com/jake32321) - **Jake Reed**
|
|---|
| 229 | * [jonchurch](https://github.com/jonchurch) - **Jon Church**
|
|---|
| 230 | * [lekanikotun](https://github.com/lekanikotun) - **Troy Goode**
|
|---|
| 231 | * [marsonya](https://github.com/marsonya) - **Lekan Ikotun**
|
|---|
| 232 | * [mastermatt](https://github.com/mastermatt) - **Matt R. Wilson**
|
|---|
| 233 | * [maxakuru](https://github.com/maxakuru) - **Max Edell**
|
|---|
| 234 | * [mlrawlings](https://github.com/mlrawlings) - **Michael Rawlings**
|
|---|
| 235 | * [rodion-arr](https://github.com/rodion-arr) - **Rodion Abdurakhimov**
|
|---|
| 236 | * [sheplu](https://github.com/sheplu) - **Jean Burellier**
|
|---|
| 237 | * [tarunyadav1](https://github.com/tarunyadav1) - **Tarun yadav**
|
|---|
| 238 | * [tunniclm](https://github.com/tunniclm) - **Mike Tunnicliffe**
|
|---|
| 239 | </details>
|
|---|
| 240 |
|
|---|
| 241 |
|
|---|
| 242 | ## License
|
|---|
| 243 |
|
|---|
| 244 | [MIT](LICENSE)
|
|---|
| 245 |
|
|---|
| 246 | [appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/express/master?label=windows
|
|---|
| 247 | [appveyor-url]: https://ci.appveyor.com/project/dougwilson/express
|
|---|
| 248 | [coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/express/master
|
|---|
| 249 | [coveralls-url]: https://coveralls.io/r/expressjs/express?branch=master
|
|---|
| 250 | [github-actions-ci-image]: https://badgen.net/github/checks/expressjs/express/master?label=linux
|
|---|
| 251 | [github-actions-ci-url]: https://github.com/expressjs/express/actions/workflows/ci.yml
|
|---|
| 252 | [npm-downloads-image]: https://badgen.net/npm/dm/express
|
|---|
| 253 | [npm-downloads-url]: https://npmcharts.com/compare/express?minimal=true
|
|---|
| 254 | [npm-install-size-image]: https://badgen.net/packagephobia/install/express
|
|---|
| 255 | [npm-install-size-url]: https://packagephobia.com/result?p=express
|
|---|
| 256 | [npm-url]: https://npmjs.org/package/express
|
|---|
| 257 | [npm-version-image]: https://badgen.net/npm/v/express
|
|---|
| 258 | [ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/express/badge
|
|---|
| 259 | [ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/express
|
|---|
| 260 | [Code of Conduct]: https://github.com/expressjs/express/blob/master/Code-Of-Conduct.md
|
|---|