Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: expressjs/express
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ef7ad681b245fba023843ce94f6bcb8e275bbb8e
Choose a base ref
...
head repository: expressjs/express
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3d7fce56a35f4f73fa437866cd1401587a212334
Choose a head ref
Loading
Showing with 7,817 additions and 1,758 deletions.
  1. +11 −0 .editorconfig
  2. +2 −0 .eslintignore
  3. +8 −0 .eslintrc.yml
  4. +161 −0 .github/workflows/ci.yml
  5. +5 −16 .gitignore
  6. +0 −12 .travis.yml
  7. +92 −0 Charter.md
  8. +139 −0 Code-Of-Conduct.md
  9. +51 −0 Collaborator-Guide.md
  10. +102 −14 Contributing.md
  11. +506 −6 History.md
  12. +125 −0 Readme-Guide.md
  13. +43 −23 Readme.md
  14. +186 −0 Release-Process.md
  15. +47 −0 Security.md
  16. +63 −0 Triager-Guide.md
  17. +87 −7 appveyor.yml
  18. +1 −4 benchmarks/middleware.js
  19. +30 −0 examples/README.md
  20. +13 −10 examples/auth/index.js
  21. +0 −48 examples/auth/pass.js
  22. +2 −0 examples/auth/views/head.ejs
  23. +2 −3 examples/auth/views/login.ejs
  24. +0 −31 examples/big-view/index.js
  25. +0 −12 examples/big-view/pets.jade
  26. +3 −1 examples/content-negotiation/db.js
  27. +2 −0 examples/content-negotiation/index.js
  28. +1 −0 examples/content-negotiation/users.js
  29. +4 −3 examples/cookie-sessions/index.js
  30. +4 −3 examples/cookies/index.js
  31. +3 −0 examples/downloads/files/notes/groceries.txt
  32. +17 −9 examples/downloads/index.js
  33. +8 −1 examples/ejs/index.js
  34. +4 −0 examples/ejs/public/stylesheets/style.css
  35. +3 −7 examples/ejs/views/header.html
  36. +2 −2 examples/ejs/views/users.html
  37. +17 −17 examples/error-pages/index.js
  38. +2 −2 examples/error-pages/views/404.ejs
  39. +2 −2 examples/error-pages/views/500.ejs
  40. +2 −0 examples/error-pages/views/error_header.ejs
  41. +2 −0 examples/error-pages/views/index.ejs
  42. +6 −1 examples/error/index.js
  43. +0 −64 examples/expose-data-to-client/index.js
  44. +0 −14 examples/expose-data-to-client/views/page.jade
  45. +3 −1 examples/hello-world/index.js
  46. +0 −51 examples/jade/index.js
  47. +0 −4 examples/jade/public/stylesheets/style.css
  48. +0 −3 examples/jade/views/header.jade
  49. +0 −5 examples/jade/views/layout.jade
  50. +0 −8 examples/jade/views/users/index.jade
  51. +0 −3 examples/jade/views/users/user.jade
  52. +10 −11 examples/markdown/index.js
  53. +2 −0 examples/multi-router/controllers/api_v1.js
  54. +2 −0 examples/multi-router/controllers/api_v2.js
  55. +3 −1 examples/multi-router/index.js
  56. +2 −0 examples/multipart/index.js
  57. +3 −1 examples/mvc/controllers/main/index.js
  58. +2 −0 examples/mvc/controllers/pet/index.js
  59. +2 −0 examples/mvc/controllers/pet/views/edit.ejs
  60. +2 −0 examples/mvc/controllers/pet/views/show.ejs
  61. +2 −0 examples/mvc/controllers/user-pet/index.js
  62. +4 −0 examples/mvc/controllers/user/index.js
  63. +27 −0 examples/mvc/controllers/user/views/edit.hbs
  64. +0 −11 examples/mvc/controllers/user/views/edit.jade
  65. +18 −0 examples/mvc/controllers/user/views/list.hbs
  66. +0 −7 examples/mvc/controllers/user/views/list.jade
  67. +31 −0 examples/mvc/controllers/user/views/show.hbs
  68. +0 −17 examples/mvc/controllers/user/views/show.jade
  69. +3 −1 examples/mvc/db.js
  70. +9 −9 examples/mvc/index.js
  71. +21 −15 examples/mvc/lib/boot.js
  72. +1 −1 examples/mvc/public/style.css
  73. +13 −0 examples/mvc/views/404.ejs
  74. +0 −3 examples/mvc/views/404.jade
  75. +13 −0 examples/mvc/views/5xx.ejs
  76. +0 −3 examples/mvc/views/5xx.jade
  77. +6 −1 examples/online/index.js
  78. +4 −2 examples/params/index.js
  79. +4 −2 examples/resource/index.js
  80. +7 −4 examples/route-map/index.js
  81. +5 −3 examples/route-middleware/index.js
  82. +7 −5 examples/route-separation/index.js
  83. +2 −0 examples/route-separation/post.js
  84. +3 −1 examples/route-separation/site.js
  85. +2 −0 examples/route-separation/user.js
  86. +2 −0 examples/route-separation/views/footer.ejs
  87. +9 −0 examples/route-separation/views/header.ejs
  88. +10 −0 examples/route-separation/views/index.ejs
  89. +0 −6 examples/route-separation/views/index.jade
  90. +0 −6 examples/route-separation/views/layout.jade
  91. +12 −0 examples/route-separation/views/posts/index.ejs
  92. +0 −8 examples/route-separation/views/posts/index.jade
  93. +23 −0 examples/route-separation/views/users/edit.ejs
  94. +0 −12 examples/route-separation/views/users/edit.jade
  95. +14 −0 examples/route-separation/views/users/index.ejs
  96. +0 −9 examples/route-separation/views/users/index.jade
  97. +9 −0 examples/route-separation/views/users/view.ejs
  98. +0 −6 examples/route-separation/views/users/view.jade
  99. +9 −12 examples/search/index.js
  100. +4 −2 examples/search/{ → public}/client.js
  101. +21 −0 examples/search/public/index.html
  102. +0 −15 examples/search/search.jade
  103. +6 −1 examples/session/index.js
  104. +2 −0 examples/session/redis.js
  105. +6 −3 examples/static-files/index.js
  106. +1 −1 examples/static-files/public/js/app.js
  107. +2 −0 examples/vhost/index.js
  108. +3 −1 examples/view-constructor/github-view.js
  109. +4 −3 examples/view-constructor/index.js
  110. +9 −6 examples/view-locals/index.js
  111. +0 −12 examples/view-locals/layout.jade
  112. +0 −8 examples/view-locals/user.jade
  113. +5 −0 examples/view-locals/user.js
  114. +20 −0 examples/view-locals/views/index.ejs
  115. +13 −8 examples/web-service/index.js
  116. +13 −12 lib/application.js
  117. +20 −7 lib/express.js
  118. +9 −2 lib/middleware/init.js
  119. +5 −9 lib/middleware/query.js
  120. +64 −28 lib/request.js
  121. +141 −47 lib/response.js
  122. +45 −22 lib/router/index.js
  123. +26 −21 lib/router/layer.js
  124. +10 −4 lib/router/route.js
  125. +30 −27 lib/utils.js
  126. +11 −2 lib/view.js
  127. +51 −42 package.json
  128. +13 −8 test/Route.js
  129. +75 −19 test/Router.js
  130. +16 −1 test/acceptance/auth.js
  131. +4 −4 test/acceptance/cookie-sessions.js
  132. +7 −12 test/acceptance/cookies.js
  133. +19 −5 test/acceptance/downloads.js
  134. +2 −5 test/acceptance/error-pages.js
  135. +1 −1 test/acceptance/error.js
  136. +21 −0 test/acceptance/hello-world.js
  137. +1 −1 test/acceptance/multi-router.js
  138. +2 −2 test/acceptance/params.js
  139. +1 −1 test/acceptance/route-map.js
  140. +5 −5 test/acceptance/web-service.js
  141. +8 −5 test/app.all.js
  142. +1 −0 test/app.del.js
  143. +15 −12 test/app.engine.js
  144. +8 −10 test/app.head.js
  145. +40 −18 test/app.js
  146. +1 −5 test/app.listen.js
  147. +9 −7 test/app.locals.js
  148. +2 −1 test/app.options.js
  149. +19 −21 test/app.param.js
  150. +62 −50 test/app.render.js
  151. +120 −0 test/app.request.js
  152. +114 −15 test/app.response.js
  153. +2 −0 test/app.route.js
  154. +121 −44 test/app.router.js
  155. +9 −6 test/app.routes.error.js
  156. +33 −18 test/app.use.js
  157. +7 −6 test/config.js
  158. +31 −4 test/exports.js
  159. +665 −0 test/express.json.js
  160. +388 −0 test/express.raw.js
  161. +814 −0 test/express.static.js
  162. +442 −0 test/express.text.js
  163. +735 −0 test/express.urlencoded.js
  164. 0 test/fixtures/broken.send
  165. 0 test/fixtures/empty.txt
  166. +1 −0 test/fixtures/nums.txt
  167. +1 −0 test/fixtures/pets/names.txt
  168. 0 test/fixtures/snow ☃/.gitkeep
  169. +1 −0 test/fixtures/todo.html
  170. +1 −0 test/fixtures/todo.txt
  171. +1 −0 test/fixtures/users/index.html
  172. +1 −0 test/fixtures/users/tobi.txt
  173. +6 −8 test/middleware.basic.js
  174. +0 −1 test/mocha.opts
  175. +1 −0 test/regression.js
  176. +1 −0 test/req.accepts.js
  177. +3 −2 test/req.acceptsCharset.js
  178. +3 −2 test/req.acceptsCharsets.js
  179. +20 −17 test/req.acceptsEncoding.js
  180. +21 −18 test/req.acceptsEncodings.js
  181. +30 −26 test/req.acceptsLanguage.js
  182. +30 −26 test/req.acceptsLanguages.js
  183. +1 −0 test/req.baseUrl.js
  184. +2 −1 test/req.fresh.js
  185. +26 −1 test/req.get.js
  186. +1 −1 test/req.host.js
  187. +51 −1 test/req.hostname.js
  188. +19 −3 test/req.ip.js
  189. +1 −0 test/req.ips.js
  190. +140 −74 test/req.is.js
  191. +2 −2 test/req.param.js
  192. +1 −0 test/req.path.js
  193. +1 −0 test/req.protocol.js
  194. +11 −8 test/req.query.js
  195. +90 −24 test/req.range.js
  196. +7 −4 test/req.route.js
  197. +1 −0 test/req.secure.js
  198. +3 −6 test/req.signedCookies.js
  199. +2 −1 test/req.stale.js
  200. +1 −0 test/req.subdomains.js
  201. +23 −55 test/req.xhr.js
  202. +1 −0 test/res.append.js
  203. +3 −1 test/res.attachment.js
  204. +5 −10 test/res.clearCookie.js
  205. +47 −42 test/res.cookie.js
  206. +120 −2 test/res.download.js
  207. +11 −8 test/res.format.js
  208. +1 −0 test/res.get.js
  209. +39 −1 test/res.json.js
  210. +98 −58 test/res.jsonp.js
  211. +1 −0 test/res.links.js
  212. +5 −6 test/res.locals.js
  213. +86 −3 test/res.location.js
  214. +62 −42 test/res.redirect.js
  215. +48 −24 test/res.render.js
  216. +91 −54 test/res.send.js
  217. +197 −81 test/res.sendFile.js
  218. +1 −1 test/res.sendStatus.js
  219. +14 −0 test/res.set.js
  220. +1 −0 test/res.status.js
  221. +3 −1 test/res.type.js
  222. +4 −9 test/res.vary.js
  223. +1 −1 test/support/env.js
  224. +1 −0 test/support/tmpl.js
  225. +58 −0 test/support/utils.js
  226. +22 −20 test/utils.js
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# http://editorconfig.org
root = true

[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true

[{*.js,*.json,*.yml}]
indent_size = 2
indent_style = space
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage
node_modules
8 changes: 8 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root: true

rules:
eol-last: error
eqeqeq: [error, allow-null]
indent: [error, 2, { MemberExpression: "off", SwitchCase: 1 }]
no-trailing-spaces: error
no-unused-vars: [error, { vars: all, args: none, ignoreRestSiblings: true }]
161 changes: 161 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
name: ci

on:
- pull_request
- push

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
name:
- Node.js 0.10
- Node.js 0.12
- io.js 1.x
- io.js 2.x
- io.js 3.x
- Node.js 4.x
- Node.js 5.x
- Node.js 6.x
- Node.js 7.x
- Node.js 8.x
- Node.js 9.x
- Node.js 10.x
- Node.js 11.x
- Node.js 12.x
- Node.js 13.x
- Node.js 14.x

include:
- name: Node.js 0.10
node-version: "0.10"
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0

- name: Node.js 0.12
node-version: "0.12"
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0

- name: io.js 1.x
node-version: "1.8"
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0

- name: io.js 2.x
node-version: "2.5"
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0

- name: io.js 3.x
node-version: "3.3"
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0

- name: Node.js 4.x
node-version: "4.9"
npm-i: mocha@5.2.0 nyc@11.9.0 supertest@3.4.2

- name: Node.js 5.x
node-version: "5.12"
npm-i: mocha@5.2.0 nyc@11.9.0 supertest@3.4.2

- name: Node.js 6.x
node-version: "6.17"
npm-i: mocha@6.2.2 nyc@14.1.1 supertest@6.1.6

- name: Node.js 7.x
node-version: "7.10"
npm-i: mocha@6.2.2 nyc@14.1.1 supertest@6.1.6

- name: Node.js 8.x
node-version: "8.17"
npm-i: mocha@7.2.0

- name: Node.js 9.x
node-version: "9.11"
npm-i: mocha@7.2.0

- name: Node.js 10.x
node-version: "10.24"
npm-i: mocha@8.4.0

- name: Node.js 11.x
node-version: "11.15"
npm-i: mocha@8.4.0

- name: Node.js 12.x
node-version: "12.22"

- name: Node.js 13.x
node-version: "13.14"

- name: Node.js 14.x
node-version: "14.19"

steps:
- uses: actions/checkout@v2

- name: Install Node.js ${{ matrix.node-version }}
shell: bash -eo pipefail -l {0}
run: |
nvm install --default ${{ matrix.node-version }}
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
- name: Configure npm
run: |
npm config set loglevel error
npm config set shrinkwrap false
- name: Install npm module(s) ${{ matrix.npm-i }}
run: npm install --save-dev ${{ matrix.npm-i }}
if: matrix.npm-i != ''

- name: Remove non-test dependencies
run: npm rm --silent --save-dev connect-redis

- name: Setup Node.js version-specific dependencies
shell: bash
run: |
# eslint for linting
# - remove on Node.js < 10
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
grep -E '^eslint(-|$)' | \
sort -r | \
xargs -n1 npm rm --silent --save-dev
fi
- name: Install Node.js dependencies
run: npm install

- name: List environment
id: list_env
shell: bash
run: |
echo "node@$(node -v)"
echo "npm@$(npm -v)"
npm -s ls ||:
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 "::" $3 }'
- name: Run tests
shell: bash
run: npm run test-ci

- name: Lint code
if: steps.list_env.outputs.eslint != ''
run: npm run lint

- name: Collect code coverage
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.test_number }}
parallel: true

coverage:
needs: test
runs-on: ubuntu-latest
steps:
- name: Upload code coverage
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
21 changes: 5 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
# OS X
.DS_Store*
Icon?
._*

# Windows
Thumbs.db
ehthumbs.db
Desktop.ini

# Linux
.directory
*~


# npm
node_modules
package-lock.json
*.log
*.gz


# Coveralls
.nyc_output
coverage

# Benchmarking
benchmarks/graphs

# ignore additional files using core.excludesFile
# https://git-scm.com/docs/gitignore
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

92 changes: 92 additions & 0 deletions Charter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Express Charter

## Section 0: Guiding Principles

The Express project is part of the OpenJS Foundation which operates
transparently, openly, collaboratively, and ethically.
Project proposals, timelines, and status must not merely be open, but
also easily visible to outsiders.

## Section 1: Scope

Express is a http web server framework with a simple and expressive API
which is highly aligned with Node.js core. We aim to be the best in
class for writing performant, spec compliant, and powerful web servers
in Node.js. As one of the oldest and most popular web frameworks in
the ecosystem, we have an important place for new users and experts
alike.

### 1.1: In-scope

Express is made of many modules spread between three GitHub Orgs:

- [expressjs](http://github.com/expressjs/): Top level middleware and
libraries
- [pillarjs](http://github.com/pillarjs/): Components which make up
Express but can also be used for other web frameworks
- [jshttp](http://github.com/jshttp/): Low level http libraries

### 1.2: Out-of-Scope

Section Intentionally Left Blank

## Section 2: Relationship with OpenJS Foundation CPC.

Technical leadership for the projects within the OpenJS Foundation is
delegated to the projects through their project charters by the OpenJS
Cross Project Council (CPC). In the case of the Express project, it is
delegated to the Express Technical Committee ("TC").

This Technical Committee is in charge of both the day-to-day operations
of the project, as well as its technical management. This charter can
be amended by the TC requiring at least two approvals and a minimum two
week comment period for other TC members or CPC members to object. Any
changes the CPC wishes to propose will be considered a priority but
will follow the same process.

### 2.1 Other Formal Project Relationships

Section Intentionally Left Blank

## Section 3: Express Governing Body

The Express project is managed by the Technical Committee ("TC").
Members can be added to the TC at any time. Any committer can nominate
another committer to the TC and the TC uses its standard consensus
seeking process to evaluate whether or not to add this new member.
Members who do not participate consistently at the level of a majority
of the other members are expected to resign.

## Section 4: Roles & Responsibilities

The Express TC manages all aspects of both the technical and community
parts of the project. Members of the TC should attend the regular
meetings when possible, and be available for discussion of time
sensitive or important issues.

### Section 4.1 Project Operations & Management

Section Intentionally Left Blank

### Section 4.2: Decision-making, Voting, and/or Elections

The Express TC uses a "consensus seeking" process for issues that are
escalated to the TC. The group tries to find a resolution that has no
open objections among TC members. If a consensus cannot be reached
that has no objections then a majority wins vote is called. It is also
expected that the majority of decisions made by the TC are via a
consensus seeking process and that voting is only used as a last-resort.

Resolution may involve returning the issue to committers with
suggestions on how to move forward towards a consensus. It is not
expected that a meeting of the TC will resolve all issues on its
agenda during that meeting and may prefer to continue the discussion
happening among the committers.

### Section 4.3: Other Project Roles

Section Intentionally Left Blank

## Section 5: Definitions

Section Intentionally Left Blank
Loading