Showing with 7,456 additions and 1,071 deletions.
  1. +1 −1 .eslintrc.yml
  2. +179 −0 .github/workflows/ci.yml
  3. +4 −16 .gitignore
  4. +0 −64 .travis.yml
  5. +92 −0 Charter.md
  6. +139 −0 Code-Of-Conduct.md
  7. +2 −1 Collaborator-Guide.md
  8. +36 −8 Contributing.md
  9. +176 −9 History.md
  10. +49 −36 Readme.md
  11. +5 −2 Security.md
  12. +63 −0 Triager-Guide.md
  13. +54 −9 appveyor.yml
  14. +12 −8 benchmarks/Makefile
  15. +1 −1 benchmarks/middleware.js
  16. +5 −3 benchmarks/run
  17. +30 −0 examples/README.md
  18. +6 −3 examples/auth/index.js
  19. +2 −0 examples/auth/views/head.ejs
  20. +6 −7 examples/auth/views/login.ejs
  21. +2 −0 examples/content-negotiation/db.js
  22. +2 −0 examples/content-negotiation/index.js
  23. +1 −0 examples/content-negotiation/users.js
  24. +2 −0 examples/cookie-sessions/index.js
  25. +2 −0 examples/cookies/index.js
  26. +3 −0 examples/downloads/files/notes/groceries.txt
  27. +14 −9 examples/downloads/index.js
  28. +2 −0 examples/ejs/index.js
  29. +1 −1 examples/ejs/public/stylesheets/style.css
  30. +1 −0 examples/ejs/views/header.html
  31. +2 −2 examples/ejs/views/users.html
  32. +2 −0 examples/error-pages/index.js
  33. +2 −2 examples/error-pages/views/404.ejs
  34. +2 −2 examples/error-pages/views/500.ejs
  35. +2 −0 examples/error-pages/views/error_header.ejs
  36. +2 −0 examples/error-pages/views/index.ejs
  37. +2 −0 examples/error/index.js
  38. +3 −1 examples/hello-world/index.js
  39. +2 −0 examples/markdown/index.js
  40. +2 −0 examples/multi-router/controllers/api_v1.js
  41. +2 −0 examples/multi-router/controllers/api_v2.js
  42. +2 −0 examples/multi-router/index.js
  43. +2 −0 examples/multipart/index.js
  44. +2 −0 examples/mvc/controllers/main/index.js
  45. +2 −0 examples/mvc/controllers/pet/index.js
  46. +2 −0 examples/mvc/controllers/pet/views/edit.ejs
  47. +2 −0 examples/mvc/controllers/pet/views/show.ejs
  48. +2 −0 examples/mvc/controllers/user-pet/index.js
  49. +2 −0 examples/mvc/controllers/user/index.js
  50. +2 −0 examples/mvc/controllers/user/views/edit.hbs
  51. +2 −0 examples/mvc/controllers/user/views/list.hbs
  52. +2 −0 examples/mvc/controllers/user/views/show.hbs
  53. +2 −0 examples/mvc/db.js
  54. +2 −0 examples/mvc/index.js
  55. +2 −0 examples/mvc/lib/boot.js
  56. +1 −1 examples/mvc/public/style.css
  57. +1 −0 examples/mvc/views/404.ejs
  58. +1 −0 examples/mvc/views/5xx.ejs
  59. +1 −0 examples/online/index.js
  60. +6 −11 examples/params/index.js
  61. +3 −1 examples/resource/index.js
  62. +6 −3 examples/route-map/index.js
  63. +3 −1 examples/route-middleware/index.js
  64. +2 −0 examples/route-separation/index.js
  65. +2 −0 examples/route-separation/post.js
  66. +2 −0 examples/route-separation/site.js
  67. +2 −0 examples/route-separation/user.js
  68. +1 −0 examples/route-separation/views/header.ejs
  69. +2 −2 examples/route-separation/views/index.ejs
  70. +2 −2 examples/route-separation/views/posts/index.ejs
  71. +3 −3 examples/route-separation/views/users/edit.ejs
  72. +2 −2 examples/route-separation/views/users/index.ejs
  73. +2 −2 examples/route-separation/views/users/view.ejs
  74. +1 −0 examples/search/index.js
  75. +2 −0 examples/search/public/client.js
  76. +3 −2 examples/search/public/index.html
  77. +1 −0 examples/session/index.js
  78. +2 −0 examples/session/redis.js
  79. +2 −0 examples/static-files/index.js
  80. +1 −1 examples/static-files/public/js/app.js
  81. +2 −0 examples/vhost/index.js
  82. +2 −0 examples/view-constructor/github-view.js
  83. +2 −0 examples/view-constructor/index.js
  84. +2 −0 examples/view-locals/index.js
  85. +2 −0 examples/view-locals/user.js
  86. +1 −0 examples/view-locals/views/index.ejs
  87. +6 −4 examples/web-service/index.js
  88. +19 −2 lib/application.js
  89. +2 −0 lib/express.js
  90. +5 −1 lib/request.js
  91. +63 −31 lib/response.js
  92. +25 −14 lib/router/index.js
  93. +15 −6 lib/router/route.js
  94. +5 −7 lib/utils.js
  95. +1 −1 lib/view.js
  96. +35 −34 package.json
  97. +49 −17 test/Route.js
  98. +56 −3 test/Router.js
  99. +16 −1 test/acceptance/auth.js
  100. +1 −1 test/acceptance/cookie-sessions.js
  101. +17 −0 test/acceptance/downloads.js
  102. +21 −0 test/acceptance/hello-world.js
  103. +3 −3 test/acceptance/web-service.js
  104. +8 −5 test/app.all.js
  105. +1 −0 test/app.del.js
  106. +8 −6 test/app.engine.js
  107. +8 −10 test/app.head.js
  108. +40 −18 test/app.js
  109. +1 −4 test/app.listen.js
  110. +16 −17 test/app.locals.js
  111. +1 −0 test/app.options.js
  112. +16 −17 test/app.param.js
  113. +28 −27 test/app.render.js
  114. +120 −0 test/app.request.js
  115. +114 −15 test/app.response.js
  116. +2 −0 test/app.route.js
  117. +60 −33 test/app.router.js
  118. +9 −6 test/app.routes.error.js
  119. +11 −9 test/app.use.js
  120. +45 −0 test/config.js
  121. +37 −11 test/exports.js
  122. +790 −0 test/express.json.js
  123. +555 −0 test/express.raw.js
  124. +814 −0 test/express.static.js
  125. +605 −0 test/express.text.js
  126. +866 −0 test/express.urlencoded.js
  127. 0 test/fixtures/empty.txt
  128. +1 −0 test/fixtures/nums.txt
  129. +1 −0 test/fixtures/pets/names.txt
  130. 0 test/fixtures/snow ☃/.gitkeep
  131. +1 −0 test/fixtures/todo.html
  132. +1 −0 test/fixtures/todo.txt
  133. +1 −0 test/fixtures/users/index.html
  134. +1 −0 test/fixtures/users/tobi.txt
  135. +3 −0 test/middleware.basic.js
  136. +0 −2 test/mocha.opts
  137. +1 −0 test/regression.js
  138. +1 −0 test/req.accepts.js
  139. +3 −2 test/req.acceptsCharset.js
  140. +3 −2 test/req.acceptsCharsets.js
  141. +19 −16 test/req.acceptsEncoding.js
  142. +20 −17 test/req.acceptsEncodings.js
  143. +29 −25 test/req.acceptsLanguage.js
  144. +29 −25 test/req.acceptsLanguages.js
  145. +1 −0 test/req.baseUrl.js
  146. +1 −0 test/req.fresh.js
  147. +1 −0 test/req.get.js
  148. +1 −0 test/req.host.js
  149. +51 −0 test/req.hostname.js
  150. +17 −1 test/req.ip.js
  151. +1 −0 test/req.ips.js
  152. +1 −0 test/req.is.js
  153. +1 −0 test/req.param.js
  154. +1 −0 test/req.path.js
  155. +1 −0 test/req.protocol.js
  156. +7 −4 test/req.query.js
  157. +1 −0 test/req.range.js
  158. +7 −4 test/req.route.js
  159. +1 −0 test/req.secure.js
  160. +1 −0 test/req.signedCookies.js
  161. +1 −0 test/req.stale.js
  162. +1 −0 test/req.subdomains.js
  163. +23 −43 test/req.xhr.js
  164. +42 −30 test/res.append.js
  165. +1 −0 test/res.attachment.js
  166. +1 −0 test/res.clearCookie.js
  167. +126 −23 test/res.cookie.js
  168. +322 −27 test/res.download.js
  169. +29 −1 test/res.format.js
  170. +1 −0 test/res.get.js
  171. +16 −0 test/res.json.js
  172. +72 −52 test/res.jsonp.js
  173. +1 −0 test/res.links.js
  174. +5 −6 test/res.locals.js
  175. +1 −0 test/res.location.js
  176. +14 −20 test/res.redirect.js
  177. +1 −0 test/res.render.js
  178. +27 −26 test/res.send.js
  179. +789 −195 test/res.sendFile.js
  180. +1 −0 test/res.sendStatus.js
  181. +1 −0 test/res.set.js
  182. +194 −12 test/res.status.js
  183. +1 −0 test/res.type.js
  184. +1 −0 test/res.vary.js
  185. +1 −1 test/support/env.js
  186. +48 −0 test/support/utils.js
  187. +26 −18 test/utils.js
2 changes: 1 addition & 1 deletion .eslintrc.yml
Expand Up @@ -3,6 +3,6 @@ root: true
rules:
eol-last: error
eqeqeq: [error, allow-null]
indent: [error, 2, { SwitchCase: 1 }]
indent: [error, 2, { MemberExpression: "off", SwitchCase: 1 }]
no-trailing-spaces: error
no-unused-vars: [error, { vars: all, args: none, ignoreRestSiblings: true }]
179 changes: 179 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,179 @@
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
- Node.js 15.x
- Node.js 16.x
- Node.js 17.x
- Node.js 18.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@3.4.2

- 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"
npm-i: mocha@9.2.2

- name: Node.js 13.x
node-version: "13.14"
npm-i: mocha@9.2.2

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

- name: Node.js 15.x
node-version: "15.14"

- name: Node.js 16.x
node-version: "16.17"

- name: Node.js 17.x
node-version: "17.9"

- name: Node.js 18.x
node-version: "18.10"

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 < 12
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 12 ]]; 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
20 changes: 4 additions & 16 deletions .gitignore
@@ -1,27 +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
64 changes: 0 additions & 64 deletions .travis.yml

This file was deleted.

92 changes: 92 additions & 0 deletions Charter.md
@@ -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