Skip to content
Myr

Merge tag '4.17.2'

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parents 8aabeca, ea537d9 · Browse files · 61 files+847 added−227 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

61 files+847 added−227 removed

  • tests:+148 added−67 removed
  • other:+699 added−160 removed

61 files+847 added−227 removed

added:.github/workflows/ci.yml+160 added
1name: ci23on:4- pull_request5- push67jobs:8 test:9 runs-on: ubuntu-latest10 strategy:11 fail-fast: false12 matrix:13 name:14 - Node.js 0.1015 - Node.js 0.1216 - io.js 1.x17 - io.js 2.x18 - io.js 3.x19 - Node.js 4.x20 - Node.js 5.x21 - Node.js 6.x22 - Node.js 7.x23 - Node.js 8.x24 - Node.js 9.x25 - Node.js 10.x26 - Node.js 11.x27 - Node.js 12.x28 - Node.js 13.x29 - Node.js 14.x3031 include:32 - name: Node.js 0.1033 node-version: "0.10"34 npm-i: mocha@3.5.3 supertest@2.0.03536 - name: Node.js 0.1237 node-version: "0.12"38 npm-i: mocha@3.5.3 supertest@2.0.03940 - name: io.js 1.x41 node-version: "1.8"42 npm-i: mocha@3.5.3 supertest@2.0.04344 - name: io.js 2.x45 node-version: "2.5"46 npm-i: mocha@3.5.3 supertest@2.0.04748 - name: io.js 3.x49 node-version: "3.3"50 npm-i: mocha@3.5.3 supertest@2.0.05152 - name: Node.js 4.x53 node-version: "4.9"54 npm-i: mocha@5.2.0 supertest@3.4.25556 - name: Node.js 5.x57 node-version: "5.12"58 npm-i: mocha@5.2.0 supertest@3.4.25960 - name: Node.js 6.x61 node-version: "6.17"62 npm-i: mocha@6.2.26364 - name: Node.js 7.x65 node-version: "7.10"66 npm-i: mocha@6.2.26768 - name: Node.js 8.x69 node-version: "8.17"70 npm-i: mocha@7.2.07172 - name: Node.js 9.x73 node-version: "9.11"74 npm-i: mocha@7.2.07576 - name: Node.js 10.x77 node-version: "10.24"78 npm-i: mocha@8.4.07980 - name: Node.js 11.x81 node-version: "11.15"82 npm-i: mocha@8.4.08384 - name: Node.js 12.x85 node-version: "12.22"8687 - name: Node.js 13.x88 node-version: "13.14"8990 - name: Node.js 14.x91 node-version: "14.18"9293 steps:94 - uses: actions/checkout@v29596 - name: Install Node.js ${{ matrix.node-version }}97 shell: bash -eo pipefail -l {0}98 run: |99 nvm install --default ${{ matrix.node-version }}100 dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"101102 - name: Configure npm103 run: |104 npm config set loglevel error105 npm config set shrinkwrap false106107 - name: Install npm module(s) ${{ matrix.npm-i }}108 run: npm install --save-dev ${{ matrix.npm-i }}109 if: matrix.npm-i != ''110111 - name: Remove non-test dependencies112 run: npm rm --silent --save-dev connect-redis113114 - name: Setup Node.js version-specific dependencies115 shell: bash116 run: |117 # eslint for linting118 # - remove on Node.js < 10119 if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then120 node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \121 grep -E '^eslint(-|$)' | \122 sort -r | \123 xargs -n1 npm rm --silent --save-dev124 fi125126 - name: Install Node.js dependencies127 run: npm install128129 - name: List environment130 id: list_env131 shell: bash132 run: |133 echo "node@$(node -v)"134 echo "npm@$(npm -v)"135 npm -s ls ||:136137 - name: Run tests138 shell: bash139 run: npm run test-ci140141 - name: Lint code142 if: steps.list_env.outputs.eslint != ''143 run: npm run lint144145 - name: Collect code coverage146 uses: coverallsapp/github-action@master147 with:148 github-token: ${{ secrets.GITHUB_TOKEN }}149 flag-name: run-${{ matrix.test_number }}150 parallel: true151152 coverage:153 needs: test154 runs-on: ubuntu-latest155 steps:156 - name: Upload code coverage157 uses: coverallsapp/github-action@master158 with:159 github-token: ${{ secrets.github_token }}160 parallel-finished: true
modified:examples/auth/views/head.ejs+2 added
1<!DOCTYPE html>2<html>3 <head>4 <meta charset="utf-8">5 <meta name="viewport" content="width=device-width,initial-scale=1">6 <title><%= title %></title>7 <style>8 body {9 padding: 50px;
11 unmodified lines
modified:examples/auth/views/login.ejs+2 added-3 removed
12<% var title = 'Authentication Example' %>3<% include head %>2<%- include('head', { title: 'Authentication Example' }) -%>34<h1>Login</h1>5<%- message %>6Try accessing <a href="/restricted">/restricted</a>, then authenticate with "tj" and "foobar".
10 unmodified lines
17 <input type="submit" value="Login">18 </p>19</form>2022<% include foot %>21<%- include('foot') -%>
added:examples/downloads/files/notes/groceries.txt+3 added
1* milk2* eggs3* bread
modified:examples/downloads/index.js+6 added-5 removed
modified:examples/ejs/public/stylesheets/style.css+1 added-1 removed
modified:examples/ejs/views/header.html+1 added
modified:examples/ejs/views/users.html+2 added-2 removed
modified:examples/error-pages/views/404.ejs+2 added-2 removed
1<% include error_header %>1<%- include('error_header') -%>2<h2>Cannot find <%= url %></h2>3<% include footer %>3<%- include('footer') -%>
modified:examples/error-pages/views/500.ejs+2 added-2 removed
1<% include error_header %>1<%- include('error_header') -%>2<h2>Error: <%= error.message %></h2>3<% if (settings['verbose errors']) { %>4 <pre><%= error.stack %></pre>5<% } else { %>6 <p>An error occurred!</p>7<% } %>8<% include footer %>8<%- include('footer') -%>
modified:examples/error-pages/views/error_header.ejs+2 added
1<!DOCTYPE html>2<html>3<head>4<meta charset="utf-8">5<meta name="viewport" content="width=device-width,initial-scale=1">6<title>Error</title>7</head>89<body>
1 unmodified line
modified:examples/error-pages/views/index.ejs+2 added
1<!DOCTYPE html>2<html>3<head>4<meta charset="utf-8">5<meta name="viewport" content="width=device-width,initial-scale=1">6<title>Custom Pages Example</title>7</head>89<body>
11 unmodified lines
modified:examples/mvc/controllers/pet/views/edit.ejs+2 added
1<!DOCTYPE html>2<html>3<head>4<meta charset="utf-8">5<meta name="viewport" content="width=device-width,initial-scale=1">6<link rel="stylesheet" href="/style.css">7<title>Edit <%= pet.name %></title>8</head>9
8 unmodified lines
modified:examples/mvc/controllers/pet/views/show.ejs+2 added
1<!DOCTYPE html>2<html>3<head>4<meta charset="utf-8">5<meta name="viewport" content="width=device-width,initial-scale=1">6<link rel="stylesheet" href="/style.css">7<title><%= pet.name %></title>8</head>9
6 unmodified lines
modified:examples/mvc/controllers/user/views/edit.hbs+2 added
1<!DOCTYPE html>2<html>3<head>4 <meta charset="utf-8">5 <meta name="viewport" content="width=device-width,initial-scale=1">6 <link rel="stylesheet" href="/style.css">7 <title>Edit {{user.name}}</title>8</head>9<body>
18 unmodified lines
modified:examples/mvc/controllers/user/views/list.hbs+2 added
1<!DOCTYPE html>2<html>3<head>4 <meta charset="utf-8">5 <meta name="viewport" content="width=device-width,initial-scale=1">6 <link rel="stylesheet" href="/style.css">7 <title>Users</title>8</head>9<body>
9 unmodified lines
modified:examples/mvc/controllers/user/views/show.hbs+2 added
1<!DOCTYPE html>2<html>3<head>4 <meta charset="utf-8">5 <meta name="viewport" content="width=device-width,initial-scale=1">6 <link rel="stylesheet" href="/style.css">7 <title>{{user.name}}</title>8</head>9<body>
22 unmodified lines
modified:examples/mvc/views/404.ejs+1 added
1<!DOCTYPE html>2<html>3 <head>4 <meta charset="utf-8">5 <meta name="viewport" content="width=device-width,initial-scale=1">6 <title>Not Found</title>7 <link rel="stylesheet" href="/style.css">8 </head>9 <body>
4 unmodified lines
modified:examples/mvc/views/5xx.ejs+1 added
1<!DOCTYPE html>2<html>3 <head>4 <meta charset="utf-8">5 <meta name="viewport" content="width=device-width,initial-scale=1">6 <title>Internal Server Error</title>7 <link rel="stylesheet" href="/style.css">8 </head>9 <body>
4 unmodified lines
modified:examples/params/index.js+1 added-1 removed
6 unmodified lines
78// Faux database910var users = [11 { name: 'tj' }11 { name: 'tj' }12 , { name: 'tobi' }13 , { name: 'loki' }14 , { name: 'jane' }15 , { name: 'bandit' }
63 unmodified lines
modified:examples/resource/index.js+1 added-1 removed
24 unmodified lines
2526// Fake records2728var users = [29 { name: 'tj' }29 { name: 'tj' }30 , { name: 'ciaran' }31 , { name: 'aaron' }32 , { name: 'guillermo' }33 , { name: 'simon' }
60 unmodified lines
modified:examples/route-map/index.js+4 added-3 removed
1/**2 * Module dependencies.3 */45var escapeHtml = require('escape-html')6var express = require('../../lib/express');78var verbose = process.env.NODE_ENV !== 'test'9
21 unmodified lines
31 res.send('user list');32 },3334 get: function(req, res){34 res.send('user ' + req.params.uid);35 res.send('user ' + escapeHtml(req.params.uid))36 },3738 delete: function(req, res){39 res.send('delete users');
1 unmodified line
41};4243var pets = {44 list: function(req, res){44 res.send('user ' + req.params.uid + '\'s pets');45 res.send('user ' + escapeHtml(req.params.uid) + '\'s pets')46 },4748 delete: function(req, res){48 res.send('delete ' + req.params.uid + '\'s pet ' + req.params.pid);49 res.send('delete ' + escapeHtml(req.params.uid) + '\'s pet ' + escapeHtml(req.params.pid))50 }51};5253app.map({
20 unmodified lines
modified:examples/route-middleware/index.js+1 added-1 removed
13 unmodified lines
14// curl -X DELETE http://localhost:3000/user/0 (unauthorized since you are not an admin)1516// Dummy users17var users = [18 { id: 0, name: 'tj', email: 'tj@vision-media.ca', role: 'member' }18 { id: 0, name: 'tj', email: 'tj@vision-media.ca', role: 'member' }19 , { id: 1, name: 'ciaran', email: 'ciaranj@gmail.com', role: 'member' }20 , { id: 2, name: 'aaron', email: 'aaron.heckmann+github@gmail.com', role: 'admin' }21];22
66 unmodified lines
modified:examples/route-separation/views/posts/index.ejs+2 added-2 removed
1<% include ../header %>1<%- include('../header') -%>23<h1>Posts</h1>45<dl id="posts">
2 unmodified lines
8 <dd><%= post.body %></dd>9 <% }) %>10</dl>1112<% include ../footer %>12<%- include('../footer') -%>
modified:examples/route-separation/views/users/edit.ejs+2 added-2 removed
1<% include ../header %>1<%- include('../header') -%>23<h1>Editing <%= user.name %></h1>45<div id="user">
13 unmodified lines
19 </p>20 </form>21</div>2223<% include ../footer %>23<%- include('../footer') -%>
modified:examples/route-separation/views/users/index.ejs+2 added-2 removed
1<% include ../header %>1<%- include('../header') -%>23<h1><%= title %></h1>45<div id="users">
4 unmodified lines
10 </li>11 <% }) %>12</div>1314<% include ../footer %>14<%- include('../footer') -%>
modified:examples/route-separation/views/users/view.ejs+2 added-2 removed
1<% include ../header %>1<%- include('../header') -%>23<h1><%= user.name %></h1>45<div id="user">6 <p>Email: <%= user.email %></p>7</div>89<% include ../footer %>9<%- include('../footer') -%>
modified:examples/route-separation/views/header.ejs+1 added
1<!DOCTYPE html>2<html lang="en">3<head>4 <meta charset="utf-8">5 <meta name="viewport" content="width=device-width,initial-scale=1">6 <title><%= title %></title>7 <link rel="stylesheet" href="/style.css">8</head>9<body>
modified:examples/route-separation/views/index.ejs+2 added-2 removed
1<% include header %>1<%- include('header') -%>23<h1><%= title %></h1>45<ul>6 <li>Visit the <a href="/users">users</a> page.</li>7 <li>Visit the <a href="/posts">posts</a> page.</li>8</ul>910<% include footer %>10<%- include('footer') -%>
modified:examples/search/public/index.html+1 added
1<!DOCTYPE html>2<html lang="en">3<head>4 <meta charset="utf-8">5 <meta name="viewport" content="width=device-width,initial-scale=1">6 <title>Search example</title>7 <style type="text/css">8 body {9 font: 14px "Helvetica Neue", Helvetica;
12 unmodified lines
modified:examples/view-locals/views/index.ejs+1 added
1<!DOCTYPE html>2<html>3 <head>4 <meta charset="utf-8">5 <meta name="viewport" content="width=device-width,initial-scale=1">6 <title><%= title %></title>7 <style media="screen">8 body {9 padding: 50px;
11 unmodified lines
modified:examples/web-service/index.js+3 added-3 removed
6 unmodified lines
7var app = module.exports = express();89// create an error with .status. we10// can then use the property in our11// custom error handler (Connect repects this prop as well)11// custom error handler (Connect respects this prop as well)1213function error(status, msg) {14 var err = new Error(msg);15 err.status = status;
38 unmodified lines
54 { name: 'cluster', url: 'https://github.com/learnboost/cluster' }55];5657var users = [58 { name: 'tobi' }58 { name: 'tobi' }59 , { name: 'loki' }60 , { name: 'jane' }61];62
41 unmodified lines
104// it will be the last middleware called, if all others105// invoke next() and do not respond.106app.use(function(req, res){107 res.status(404);108 res.send({ error: "Lame, can't find that" });108 res.send({ error: "Sorry, can't find that" })109});110111/* istanbul ignore next */112if (!module.parent) {
3 unmodified lines
added:examples/README.md+30 added
1# Express examples23This page contains list of examples using Express.45- [auth](./auth) - Authentication with login and password6- [content-negotiation](./content-negotiation) - HTTP content negotiation7- [cookie-sessions](./cookie-sessions) - Working with cookie-based sessions8- [cookies](./cookies) - Working with cookies9- [downloads](./downloads) - Transferring files to client10- [ejs](./ejs) - Working with Embedded JavaScript templating (ejs)11- [error-pages](./error-pages) - Creating error pages12- [error](./error) - Working with error middleware13- [hello-world](./hello-world) - Simple request handler14- [markdown](./markdown) - Markdown as template engine15- [multi-router](./multi-router) - Working with multiple Express routers16- [multipart](./multipart) - Accepting multipart-encoded forms17- [mvc](./mvc) - MVC-style controllers18- [online](./online) - Tracking online user activity with `online` and `redis` packages19- [params](./params) - Working with route parameters20- [resource](./resource) - Multiple HTTP operations on the same resource21- [route-map](./route-map) - Organizing routes using a map22- [route-middleware](./route-middleware) - Working with route middleware23- [route-separation](./route-separation) - Organizing routes per each resource24- [search](./search) - Search API25- [session](./session) - User sessions26- [static-files](./static-files) - Serving static files27- [vhost](./vhost) - Working with virtual hosts28- [view-constructor](./view-constructor) - Rendering views dynamically29- [view-locals](./view-locals) - Saving data in request object between middleware calls30- [web-service](./web-service) - Simple API service
modified:lib/application.js+1 added-1 removed
270 unmodified lines
271 *272 * In this case EJS provides a `.renderFile()` method with273 * the same signature that Express expects: `(path, options, callback)`,274 * though note that it aliases this method as `ejs.__express` internally275 * so if you're using ".ejs" extensions you dont need to do anything.275 * so if you're using ".ejs" extensions you don't need to do anything.276 *277 * Some template engines do not follow this convention, the278 * [Consolidate.js](https://github.com/tj/consolidate.js)279 * library was created to map all of node's popular template
351 unmodified lines
modified:lib/request.js+1 added-1 removed
228 unmodified lines
229});230231/**232 * Check if the incoming request contains the "Content-Type"233 * header field, and it contains the give mime `type`.233 * header field, and it contains the given mime `type`.234 *235 * Examples:236 *237 * // With Content-Type: text/html; charset=utf-8
278 unmodified lines
modified:lib/response.js+13 added-8 removed
264 unmodified lines
265266 // restrict callback charset267 callback = callback.replace(/[^\[\]\w$.]/g, '');268269 if (body === undefined) {270 // empty argument271 body = ''272 } else if (typeof body === 'string') {269 // replace chars not allowed in JavaScript that are in JSON270 body = body271 .replace(/\u2028/g, '\\u2028')272 .replace(/\u2029/g, '\\u2029');273 // replace chars not allowed in JavaScript that are in JSON274 body = body275 .replace(/\u2028/g, '\\u2028')276 .replace(/\u2029/g, '\\u2029')277 }278279 // the /**/ is a specific security mitigation for "Rosetta Flash JSONP abuse"280 // the typeof check is just to reduce client error noise281 body = '/**/ typeof ' + callback + ' === \'function\' && ' + callback + '(' + body + ');';
30 unmodified lines
312 * Transfer the file at the given `path`.313 *314 * Automatically sets the _Content-Type_ response header field.315 * The callback `callback(err)` is invoked when the transfer is complete311 * or when an error occurs. Be sure to check `res.sentHeader`316 * or when an error occurs. Be sure to check `res.headersSent`317 * if you wish to attempt responding, as the header and some data318 * may have already been transferred.319 *320 * Options:
178 unmodified lines
499 * 'text/html': function(){500 * res.send('<p>hey</p>');501 * },502 *498 * 'appliation/json': function(){503 * 'application/json': function () {504 * res.send({ message: 'hey' });505 * }506 * });507 *
94 unmodified lines
602 if (prev) {603 // concat the new and prev vals604 value = Array.isArray(prev) ? prev.concat(val)605 : Array.isArray(val) ? [prev].concat(val)601 : [prev, val];606 : [prev, val]607 }608609 return this.set(field, value);610};
376 unmodified lines
987 var json = replacer || spaces988 ? JSON.stringify(value, replacer, spaces)989 : JSON.stringify(value);990986 if (escape) {991 if (escape && typeof json === 'string') {992 json = json.replace(/[<>&]/g, function (c) {993 switch (c.charCodeAt(0)) {994 case 0x3c:995 return '\\u003c'
13 unmodified lines
modified:lib/utils.js+2 added-6 removed
115 unmodified lines
116 }117118 switch (val) {119 case true:120 case 'weak':121 fn = exports.wetag;122 break;123 case false:124 break;125 case 'strong':126 fn = exports.etag;127 break;127 case 'weak':128 fn = exports.wetag;129 break;128 default:129 throw new TypeError('unknown value for etag function: ' + val);130 }131
16 unmodified lines
148 }149150 switch (val) {151 case true:152 case 'simple':153 fn = querystring.parse;154 break;155 case false:156 break;157 case 'extended':158 fn = parseExtendedQueryString;159 break;161 case 'simple':162 fn = querystring.parse;163 break;160 default:161 throw new TypeError('unknown value for query parser function: ' + val);162 }163
87 unmodified lines
modified:test/acceptance/cookie-sessions.js+1 added-1 removed
11 unmodified lines
1213 it('should set a session cookie', function (done) {14 request(app)15 .get('/')16 .expect('Set-Cookie', /express:sess=/)16 .expect('Set-Cookie', /session=/)17 .expect(200, done)18 })1920 it('should display 1 view on revisit', function (done) {
18 unmodified lines
modified:test/acceptance/downloads.js+9 added
9 unmodified lines
10 .expect(/href="\/files\/amazing.txt"/, done)11 })12 })1314 describe('GET /files/notes/groceries.txt', function () {15 it('should have a download header', function (done) {16 request(app)17 .get('/files/notes/groceries.txt')18 .expect('Content-Disposition', 'attachment; filename="groceries.txt"')19 .expect(200, done)20 })21 })2223 describe('GET /files/amazing.txt', function(){24 it('should have a download header', function(done){25 request(app)26 .get('/files/amazing.txt')
13 unmodified lines
modified:test/acceptance/web-service.js+3 added-3 removed
95 unmodified lines
9697 describe('when requesting an invalid route', function(){98 it('should respond with 404 json', function(done){99 request(app)100 .get('/api/something?api-key=bar')101 .expect('Content-Type', /json/)102 .expect(404, '{"error":"Lame, can\'t find that"}', done)100 .get('/api/something?api-key=bar')101 .expect('Content-Type', /json/)102 .expect(404, '{"error":"Sorry, can\'t find that"}', done)103 })104 })105})
modified:test/app.head.js+1 added-1 removed
24 unmodified lines
25 res.send('tobi');26 });2728 request(app)29 .get('/tobi')29 .head('/tobi')30 .expect(200, function(err, res){31 if (err) return done(err);32 var headers = res.headers;33 request(app)
35 unmodified lines
modified:test/app.listen.js-4 removed
3 unmodified lines
4describe('app.listen()', function(){5 it('should wrap with an HTTP server', function(done){6 var app = express();78 app.get('/tobi', function(req, res){9 res.end('got tobi!');10 });118 var server = app.listen(9999, function(){9 server.close();10 done();11 });
2 unmodified lines
modified:test/app.param.js+1 added-1 removed
142 unmodified lines
143 next();144 });145146 app.param('user', function(req, res, next, user) {147 next(new Error('invalid invokation'));147 next(new Error('invalid invocation'))148 });149150 app.post('/:user', function(req, res, next) {151 res.send(req.params.user);
174 unmodified lines
modified:test/app.router.js+29 added
186 unmodified lines
187 request(app)188 .get('/user/10/edit')189 .expect('editing user 10', done);190 })191192 it.skip('should ensure regexp matches path prefix', function (done) {193 var app = express()194 var p = []195196 app.use(/\/api.*/, function (req, res, next) {197 p.push('a')198 next()199 })200 app.use(/api/, function (req, res, next) {201 p.push('b')202 next()203 })204 app.use(/\/test/, function (req, res, next) {205 p.push('c')206 next()207 })208 app.use(function (req, res) {209 res.end()210 })211212 request(app)213 .get('/test/api/1234')214 .expect(200, function (err) {215 if (err) return done(err)216 assert.deepEqual(p, ['c'])217 done()218 })219 })220 })221222 describe('case sensitivity', function(){223 it('should be disabled by default', function(done){
1018 unmodified lines
modified:test/express.static.js+2 added-2 removed
427 unmodified lines
428 })429430 describe('lastModified', function () {431 describe('when false', function () {432 it('should not include Last-Modifed', function (done) {432 it('should not include Last-Modified', function (done) {433 request(createApp(fixtures, { 'lastModified': false }))434 .get('/nums.txt')435 .expect(utils.shouldNotHaveHeader('Last-Modified'))436 .expect(200, '123456789', done)437 })438 })439440 describe('when true', function () {441 it('should include Last-Modifed', function (done) {441 it('should include Last-Modified', function (done) {442 request(createApp(fixtures, { 'lastModified': true }))443 .get('/nums.txt')444 .expect('Last-Modified', /^\w{3}, \d+ \w+ \d+ \d+:\d+:\d+ \w+$/)445 .expect(200, '123456789', done)
368 unmodified lines
modified:test/res.cookie.js+13 added
113 unmodified lines
114 request(app)115 .get('/')116 .expect(200, optionsCopy, done)117 })118119 it('should throw an error with invalid maxAge', function (done) {120 var app = express()121122 app.use(function (req, res) {123 res.cookie('name', 'tobi', { maxAge: 'foobar' })124 res.end()125 })126127 request(app)128 .get('/')129 .expect(500, /option maxAge is invalid/, done)130 })131 })132133 describe('signed', function(){134 it('should generate a signed JSON cookie', function(done){
53 unmodified lines
modified:test/res.json.js+15 added
120 unmodified lines
121 .get('/')122 .expect('Content-Type', 'application/json; charset=utf-8')123 .expect(200, '{"\\u0026":"\\u003cscript\\u003e"}', done)124 })125126 it('should not break undefined escape', function (done) {127 var app = express()128129 app.enable('json escape')130131 app.use(function (req, res) {132 res.json(undefined)133 })134135 request(app)136 .get('/')137 .expect('Content-Type', 'application/json; charset=utf-8')138 .expect(200, '', done)139 })140 })141142 describe('"json replacer" setting', function(){143 it('should be passed to JSON.stringify()', function(done){
42 unmodified lines
modified:test/res.jsonp.js+71 added-52 removed
154 unmodified lines
155 .expect('X-Content-Type-Options', 'nosniff')156 .expect(200, /cb\(\{"hello":"world"\}\);$/, done);157 })158159 describe('when given primitives', function(){160 it('should respond with json', function(done){161 var app = express();159 describe('when given undefined', function () {160 it('should invoke callback with no arguments', function (done) {161 var app = express()162163 app.use(function(req, res){164 res.jsonp(null);165 });163 app.use(function (req, res) {164 res.jsonp(undefined)165 })166167 request(app)168 .get('/')169 .expect('Content-Type', 'application/json; charset=utf-8')170 .expect(200, 'null', done)168 .get('/?callback=cb')169 .expect('Content-Type', 'text/javascript; charset=utf-8')170 .expect(200, /cb\(\)/, done)171 })172 })173174 describe('when given an array', function(){175 it('should respond with json', function(done){176 var app = express();174 describe('when given null', function () {175 it('should invoke callback with null', function (done) {176 var app = express()177178 app.use(function(req, res){179 res.jsonp(['foo', 'bar', 'baz']);180 });178 app.use(function (req, res) {179 res.jsonp(null)180 })181182 request(app)183 .get('/')184 .expect('Content-Type', 'application/json; charset=utf-8')185 .expect(200, '["foo","bar","baz"]', done)183 .get('/?callback=cb')184 .expect('Content-Type', 'text/javascript; charset=utf-8')185 .expect(200, /cb\(null\)/, done)186 })187 })188189 describe('when given an object', function(){190 it('should respond with json', function(done){191 var app = express();189 describe('when given a string', function () {190 it('should invoke callback with a string', function (done) {191 var app = express()192193 app.use(function(req, res){194 res.jsonp({ name: 'tobi' });195 });193 app.use(function (req, res) {194 res.jsonp('tobi')195 })196197 request(app)198 .get('/')199 .expect('Content-Type', 'application/json; charset=utf-8')200 .expect(200, '{"name":"tobi"}', done)198 .get('/?callback=cb')199 .expect('Content-Type', 'text/javascript; charset=utf-8')200 .expect(200, /cb\("tobi"\)/, done)201 })202 })203204 describe('when given primitives', function(){205 it('should respond with json for null', function(done){206 var app = express();204 describe('when given a number', function () {205 it('should invoke callback with a number', function (done) {206 var app = express()207208 app.use(function(req, res){209 res.jsonp(null);210 });208 app.use(function (req, res) {209 res.jsonp(42)210 })211212 request(app)213 .get('/')214 .expect('Content-Type', 'application/json; charset=utf-8')215 .expect(200, 'null', done)213 .get('/?callback=cb')214 .expect('Content-Type', 'text/javascript; charset=utf-8')215 .expect(200, /cb\(42\)/, done)216 })217 })218219 describe('when given an array', function () {218 it('should respond with json for Number', function(done){219 var app = express();220 it('should invoke callback with an array', function (done) {221 var app = express()222221 app.use(function(req, res){222 res.jsonp(300);223 });223 app.use(function (req, res) {224 res.jsonp(['foo', 'bar', 'baz'])225 })226227 request(app)226 .get('/')227 .expect('Content-Type', 'application/json; charset=utf-8')228 .expect(200, '300', done)228 .get('/?callback=cb')229 .expect('Content-Type', 'text/javascript; charset=utf-8')230 .expect(200, /cb\(\["foo","bar","baz"\]\)/, done)231 })232 })233234 describe('when given an object', function () {231 it('should respond with json for String', function(done){232 var app = express();235 it('should invoke callback with an object', function (done) {236 var app = express()237234 app.use(function(req, res){235 res.jsonp('str');236 });238 app.use(function (req, res) {239 res.jsonp({ name: 'tobi' })240 })241242 request(app)239 .get('/')240 .expect('Content-Type', 'application/json; charset=utf-8')241 .expect(200, '"str"', done)243 .get('/?callback=cb')244 .expect('Content-Type', 'text/javascript; charset=utf-8')245 .expect(200, /cb\(\{"name":"tobi"\}\)/, done)246 })247 })248249 describe('"json escape" setting', function () {
15 unmodified lines
265 .get('/?callback=foo')266 .expect('Content-Type', 'text/javascript; charset=utf-8')267 .expect(200, /foo\({"\\u0026":"\\u2028\\u003cscript\\u003e\\u2029"}\)/, done)268 })269270 it('should not break undefined escape', function (done) {271 var app = express()272273 app.enable('json escape')274275 app.use(function (req, res) {276 res.jsonp(undefined)277 })278279 request(app)280 .get('/?callback=cb')281 .expect('Content-Type', 'text/javascript; charset=utf-8')282 .expect(200, /cb\(\)/, done)283 })284 })285286 describe('"json replacer" setting', function(){287 it('should be passed to JSON.stringify()', function(done){
56 unmodified lines
modified:test/Router.js+3 added-3 removed
30 unmodified lines
31 var router = new Router();32 var another = new Router();3334 another.get('/:bar', function(req, res){35 req.params.bar.should.equal('route');35 assert.strictEqual(req.params.bar, 'route')36 res.end();37 });38 router.use('/:foo', another);39
3 unmodified lines
43 it('should handle blank URL', function(done){44 var router = new Router();4546 router.use(function (req, res) {47 false.should.be.true()47 throw new Error('should not be called')48 });4950 router.handle({ url: '', method: 'GET' }, {}, done);51 });
32 unmodified lines
84 });8586 var res = {87 send: function(val) {88 val.should.equal('foo');88 assert.strictEqual(val, 'foo')89 done();90 }91 }92 router.handle({ url: '/foo', method: 'GET' }, res, function(){});
478 unmodified lines
modified:.eslintrc.yml+1 added-1 removed
1 unmodified line
23rules:4 eol-last: error5 eqeqeq: [error, allow-null]6 indent: [error, 2, { SwitchCase: 1 }]6 indent: [error, 2, { MemberExpression: "off", SwitchCase: 1 }]7 no-trailing-spaces: error8 no-unused-vars: [error, { vars: all, args: none, ignoreRestSiblings: true }]
deleted:.travis.yml-66 removed
1language: node_js2node_js:3 - "0.10"4 - "0.12"5 - "1.8"6 - "2.5"7 - "3.3"8 - "4.9"9 - "5.12"10 - "6.17"11 - "7.10"12 - "8.16"13 - "9.11"14 - "10.15"15 - "11.15"16 - "12.3"17matrix:18 include:19 - node_js: "13"20 env: "NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly"21 allow_failures:22 # Allow the nightly installs to fail23 - env: "NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly"24sudo: false25cache:26 directories:27 - node_modules28before_install:29 # Configure npm30 - |31 # Skip updating shrinkwrap / lock32 npm config set shrinkwrap false33 # Remove all non-test dependencies34 - |35 # Remove example dependencies36 npm rm --silent --save-dev connect-redis37 # Setup Node.js version-specific dependencies38 - |39 # mocha for testing40 # - use 3.x for Node.js < 641 if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 6 ]]; then42 npm install --silent --save-dev mocha@3.5.343 fi44 - |45 # supertest for http calls46 # - use 2.0.0 for Node.js < 447 if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 4 ]]; then48 npm install --silent --save-dev supertest@2.0.049 fi50 # Update Node.js modules51 - |52 # Prune and rebuild node_modules53 if [[ -d node_modules ]]; then54 npm prune55 npm rebuild56 fi57script:58 # Run test script59 - npm run test-ci60 # Run linting61 - npm run lint62after_script:63 - |64 # Upload coverage to coveralls65 npm install --save-dev coveralls@2.12.066 coveralls < ./coverage/lcov.info
modified:appveyor.yml+28 added-9 removed
7 unmodified lines
8 - nodejs_version: "4.9"9 - nodejs_version: "5.12"10 - nodejs_version: "6.17"11 - nodejs_version: "7.10"12 - nodejs_version: "8.16"12 - nodejs_version: "8.17"13 - nodejs_version: "9.11"14 - nodejs_version: "10.15"14 - nodejs_version: "10.24"15 - nodejs_version: "11.15"16 - nodejs_version: "12.3"16 - nodejs_version: "12.22"17 - nodejs_version: "13.14"18 - nodejs_version: "14.18"19cache:20 - node_modules21install:22 # Install Node.js
1 unmodified line
24 try { Install-Product node $env:nodejs_version -ErrorAction Stop }25 catch { Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) }26 # Configure npm27 - ps: |26 # Skip updating shrinkwrap / lock28 npm config set loglevel error29 npm config set shrinkwrap false30 # Remove all non-test dependencies31 - ps: |32 # Remove example dependencies33 npm rm --silent --save-dev connect-redis34 # Remove lint dependencies35 cmd.exe /c "node -pe `"Object.keys(require('./package').devDependencies).join('\n')`"" | `36 sls "^eslint(-|$)" | `37 %{ npm rm --silent --save-dev $_ }38 # Setup Node.js version-specific dependencies39 - ps: |40 # mocha for testing35 # - use 3.x for Node.js < 636 if ($env:nodejs_version.split(".")[0] -lt 6) {41 # - use 3.x for Node.js < 442 # - use 5.x for Node.js < 643 # - use 6.x for Node.js < 844 # - use 7.x for Node.js < 1045 # - use 8.x for Node.js < 1246 if ([int]$env:nodejs_version.split(".")[0] -lt 4) {47 npm install --silent --save-dev mocha@3.5.348 } elseif ([int]$env:nodejs_version.split(".")[0] -lt 6) {49 npm install --silent --save-dev mocha@5.2.050 } elseif ([int]$env:nodejs_version.split(".")[0] -lt 8) {51 npm install --silent --save-dev mocha@6.2.252 } elseif ([int]$env:nodejs_version.split(".")[0] -lt 10) {53 npm install --silent --save-dev mocha@7.2.054 } elseif ([int]$env:nodejs_version.split(".")[0] -lt 12) {55 npm install --silent --save-dev mocha@8.4.056 }57 - ps: |58 # supertest for http calls59 # - use 2.0.0 for Node.js < 460 # - use 3.4.2 for Node.js < 642 if ($env:nodejs_version.split(".")[0] -lt 4) {61 if ([int]$env:nodejs_version.split(".")[0] -lt 4) {62 npm install --silent --save-dev supertest@2.0.063 } elseif ([int]$env:nodejs_version.split(".")[0] -lt 6) {64 npm install --silent --save-dev supertest@3.4.265 }66 # Update Node.js modules67 - ps: |68 # Prune & rebuild node_modules
10 unmodified lines
79 node --version80 npm --version81 # Run test script82 - npm run test-ci62 # Run linting63 - npm run lint83version: "{build}"
added:Charter.md+92 added
1# Express Charter23## Section 0: Guiding Principles45The Express project is part of the OpenJS Foundation which operates6transparently, openly, collaboratively, and ethically.7Project proposals, timelines, and status must not merely be open, but8also easily visible to outsiders.910## Section 1: Scope1112Express is a http web server framework with a simple and expressive API13which is highly aligned with Node.js core. We aim to be the best in14class for writing performant, spec compliant, and powerful web servers15in Node.js. As one of the oldest and most popular web frameworks in16the ecosystem, we have an important place for new users and experts17alike.1819### 1.1: In-scope2021Express is made of many modules spread between three GitHub Orgs:2223- [expressjs](http://github.com/expressjs/): Top level middleware and24 libraries25- [pillarjs](http://github.com/pillarjs/): Components which make up26 Express but can also be used for other web frameworks27- [jshttp](http://github.com/jshttp/): Low level http libraries2829### 1.2: Out-of-Scope3031Section Intentionally Left Blank3233## Section 2: Relationship with OpenJS Foundation CPC.3435Technical leadership for the projects within the OpenJS Foundation is36delegated to the projects through their project charters by the OpenJS37Cross Project Council (CPC). In the case of the Express project, it is38delegated to the Express Technical Committee ("TC").3940This Technical Committee is in charge of both the day-to-day operations41of the project, as well as its technical management. This charter can42be amended by the TC requiring at least two approvals and a minimum two43week comment period for other TC members or CPC members to object. Any44changes the CPC wishes to propose will be considered a priority but45will follow the same process.4647### 2.1 Other Formal Project Relationships4849Section Intentionally Left Blank5051## Section 3: Express Governing Body5253The Express project is managed by the Technical Committee ("TC").54Members can be added to the TC at any time. Any committer can nominate55another committer to the TC and the TC uses its standard consensus56seeking process to evaluate whether or not to add this new member.57Members who do not participate consistently at the level of a majority58of the other members are expected to resign.5960## Section 4: Roles & Responsibilities6162The Express TC manages all aspects of both the technical and community63parts of the project. Members of the TC should attend the regular64meetings when possible, and be available for discussion of time65sensitive or important issues.6667### Section 4.1 Project Operations & Management6869Section Intentionally Left Blank7071### Section 4.2: Decision-making, Voting, and/or Elections7273The Express TC uses a "consensus seeking" process for issues that are74escalated to the TC. The group tries to find a resolution that has no75open objections among TC members. If a consensus cannot be reached76that has no objections then a majority wins vote is called. It is also77expected that the majority of decisions made by the TC are via a78consensus seeking process and that voting is only used as a last-resort.7980Resolution may involve returning the issue to committers with81suggestions on how to move forward towards a consensus. It is not82expected that a meeting of the TC will resolve all issues on its83agenda during that meeting and may prefer to continue the discussion84happening among the committers.8586### Section 4.3: Other Project Roles8788Section Intentionally Left Blank8990## Section 5: Definitions9192Section Intentionally Left Blank
added:Code-Of-Conduct.md+139 added
1# Contributor Covenant Code of Conduct23As a member of the Open JS Foundation, Express has adopted the4[Contributor Covenant 2.0][cc-20-doc].56If an issue arises and you cannot resolve it directly with the parties7involved, you can report it to the Express project TC through the following8email: express-coc@lists.openjsf.org910In addition, the OpenJS Foundation maintains a Code of Conduct Panel (CoCP).11This is a foundation-wide team established to manage escalation when a reporter12believes that a report to a member project or the CPC has not been properly13handled. In order to escalate to the CoCP send an email to14coc-escalation@lists.openjsf.org.1516## Our Pledge1718We as members, contributors, and leaders pledge to make participation in our19community a harassment-free experience for everyone, regardless of age, body20size, visible or invisible disability, ethnicity, sex characteristics, gender21identity and expression, level of experience, education, socio-economic status,22nationality, personal appearance, race, religion, or sexual identity and23orientation.2425We pledge to act and interact in ways that contribute to an open, welcoming,26diverse, inclusive, and healthy community.2728## Our Standards2930Examples of behavior that contributes to a positive environment for our31community include:3233* Demonstrating empathy and kindness toward other people34* Being respectful of differing opinions, viewpoints, and experiences35* Giving and gracefully accepting constructive feedback36* Accepting responsibility and apologizing to those affected by our mistakes,37 and learning from the experience38* Focusing on what is best not just for us as individuals, but for the overall39 community4041Examples of unacceptable behavior include:4243* The use of sexualized language or imagery, and sexual attention or advances44 of any kind45* Trolling, insulting or derogatory comments, and personal or political attacks46* Public or private harassment47* Publishing others' private information, such as a physical or email address,48 without their explicit permission49* Other conduct which could reasonably be considered inappropriate in a50 professional setting5152## Enforcement Responsibilities5354Community leaders are responsible for clarifying and enforcing our standards of55acceptable behavior and will take appropriate and fair corrective action in56response to any behavior that they deem inappropriate, threatening, offensive,57or harmful.5859Community leaders have the right and responsibility to remove, edit, or reject60comments, commits, code, wiki edits, issues, and other contributions that are61not aligned to this Code of Conduct, and will communicate reasons for62moderation decisions when appropriate.6364## Scope6566This Code of Conduct applies within all community spaces, and also applies when67an individual is officially representing the community in public spaces.68Examples of representing our community include using an official e-mail69address, posting via an official social media account, or acting as an70appointed representative at an online or offline event.7172## Enforcement7374Instances of abusive, harassing, or otherwise unacceptable behavior may be75reported to the community leaders responsible for enforcement at76express-coc@lists.openjsf.org. All complaints will be reviewed and77investigated promptly and fairly.7879All community leaders are obligated to respect the privacy and security of the80reporter of any incident.8182## Enforcement Guidelines8384Community leaders will follow these Community Impact Guidelines in determining85the consequences for any action they deem in violation of this Code of Conduct:8687### 1. Correction8889**Community Impact**: Use of inappropriate language or other behavior deemed90unprofessional or unwelcome in the community.9192**Consequence**: A private, written warning from community leaders, providing93clarity around the nature of the violation and an explanation of why the94behavior was inappropriate. A public apology may be requested.9596### 2. Warning9798**Community Impact**: A violation through a single incident or series of99actions.100101**Consequence**: A warning with consequences for continued behavior. No102interaction with the people involved, including unsolicited interaction with103those enforcing the Code of Conduct, for a specified period of time. This104includes avoiding interactions in community spaces as well as external channels105like social media. Violating these terms may lead to a temporary or permanent106ban.107108### 3. Temporary Ban109110**Community Impact**: A serious violation of community standards, including111sustained inappropriate behavior.112113**Consequence**: A temporary ban from any sort of interaction or public114communication with the community for a specified period of time. No public or115private interaction with the people involved, including unsolicited116interaction with those enforcing the Code of Conduct, is allowed during this117period. Violating these terms may lead to a permanent ban.118119### 4. Permanent Ban120121**Community Impact**: Demonstrating a pattern of violation of community122standards, including sustained inappropriate behavior, harassment of an123individual, or aggression toward or disparagement of classes of individuals.124125**Consequence**: A permanent ban from any sort of public interaction within the126project community.127128## Attribution129130This Code of Conduct is adapted from the [Contributor Covenant, version 2.0](cc-20-doc).131132Community Impact Guidelines were inspired by133[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).134135[cc-20-doc]: https://www.contributor-covenant.org/version/2/0/code_of_conduct/136137For answers to common questions about this code of conduct, see the FAQ at138https://www.contributor-covenant.org/faq. Translations are available at139https://www.contributor-covenant.org/translations.
modified:Collaborator-Guide.md+2 added-1 removed
1# Express Collaborator Guide23## Website Issues45Open issues for the expressjs.com website in https://github.com/expressjs/expressjs.com.
15 unmodified lines
21## Steps for contributing22231. [Create an issue](https://github.com/expressjs/express/issues/new) for the24 bug you want to fix or the feature that you want to add.242. Create your own [fork](https://github.com/expressjs/express) on github, then252. Create your own [fork](https://github.com/expressjs/express) on GitHub, then26 checkout your fork.273. Write your code in your local copy. It's good practice to create a branch for28 each new issue you work on, although not compulsory.294. To run the test suite, first install the dependencies by running `npm install`,
22 unmodified lines
modified:Contributing.md+35 added-7 removed
12 unmodified lines
13* A **Contributor** is any individual creating or commenting on an issue or pull request.14* A **Committer** is a subset of contributors who have been given write access to the repository.15* A **TC (Technical Committee)** is a group of committers representing the required technical16expertise to resolve rare disputes.17* A **Triager** is a subset of contributors who have been given triage access to the repository.1818# Logging Issues19## Logging Issues2021Log an issue for any question or problem you might have. When in doubt, log an issue, and22any additional policies about what to include will be provided in the responses. The only23exception is security disclosures which should be sent privately.
3 unmodified lines
2728Please be courteous and respectful. Every participant is expected to follow the29project's Code of Conduct.3030# Contributions31## Contributions3233Any change to resources in this repository must be through pull requests. This applies to all changes34to documentation, code, binary files, etc. Even long term committers and TC members must use35pull requests.
5 unmodified lines
41weekends and other holiday periods to ensure active committers all have reasonable time to42become involved in the discussion and review process if they wish.4344The default for each contribution is that it is accepted once no committer has an objection.44During review committers may also request that a specific contributor who is most versed in a45During a review, committers may also request that a specific contributor who is most versed in a46particular area gives a "LGTM" before the PR can be merged. There is no additional "sign off"47process for contributions to land. Once all issues brought by committers are addressed it can48be landed by any committer.49
6 unmodified lines
56discuss pending contributions in order to find a resolution. It is expected that only a57small minority of issues be brought to the TC for resolution and that discussion and58compromise among committers be the default resolution mechanism.5959# Becoming a Committer60## Becoming a Triager6162Anyone can become a triager! Read more about the process of being a triager in63[the triage process document](Triager-Guide.md).6465[Open an issue in `expressjs/express` repo](https://github.com/expressjs/express/issues/new)66to request the triage role. State that you have read and agree to the67[Code of Conduct](Code-Of-Conduct.md) and details of the role.6869Here is an example issue content you can copy and paste:7071```72Title: Request triager role for <your GitHub username>7374I have read and understood the project's Code of Conduct.75I also have read and understood the process and best practices around Express triaging.7677I request for a triager role for the following GitHub organizations:7879jshttp80pillarjs81express82```8384Once you have opened your issue, a member of the TC will add you to the `triage` team in85the organizations requested. They will then close the issue.8687Happy triaging!8889## Becoming a Committer9091All contributors who land a non-trivial contribution should be on-boarded in a timely manner,92and added as a committer, and be given write access to the repository.9394Committers are expected to follow this policy and continue to send pull requests, go through95proper review, and have other committers merge their pull requests.9667# TC Process97## TC Process9899The TC uses a "consensus seeking" process for issues that are escalated to the TC.100The group tries to find a resolution that has no open objections among TC members.101If a consensus cannot be reached that has no objections then a majority wins vote
8 unmodified lines
110Members can be added to the TC at any time. Any committer can nominate another committer111to the TC and the TC uses its standard consensus seeking process to evaluate whether or112not to add this new member. Members who do not participate consistently at the level of113a majority of the other members are expected to resign.8485
modified:History.md+38 added
15.x2===34This incorporates all changes after 4.17.1 up to 4.17.2.565.0.0-alpha.8 / 2020-03-257==========================89This is the eighth Express 5.0 alpha release, based off 4.17.1 and includes
113 unmodified lines
123 - `req.query` is now a getter instead of a plain property124 * add:125 - `app.router` is a reference to the base router1261274.17.2 / 2021-12-16128===================129130 * Fix handling of `undefined` in `res.jsonp`131 * Fix handling of `undefined` when `"json escape"` is enabled132 * Fix incorrect middleware execution with unanchored `RegExp`s133 * Fix `res.jsonp(obj, status)` deprecation message134 * Fix typo in `res.is` JSDoc135 * deps: body-parser@1.19.1136 - deps: bytes@3.1.1137 - deps: http-errors@1.8.1138 - deps: qs@6.9.6139 - deps: raw-body@2.4.2140 - deps: safe-buffer@5.2.1141 - deps: type-is@~1.6.18142 * deps: content-disposition@0.5.4143 - deps: safe-buffer@5.2.1144 * deps: cookie@0.4.1145 - Fix `maxAge` option to reject invalid values146 * deps: proxy-addr@~2.0.7147 - Use `req.socket` over deprecated `req.connection`148 - deps: forwarded@0.2.0149 - deps: ipaddr.js@1.9.1150 * deps: qs@6.9.6151 * deps: safe-buffer@5.2.1152 * deps: send@0.17.2153 - deps: http-errors@1.8.1154 - deps: ms@2.1.3155 - pref: ignore empty http tokens156 * deps: serve-static@1.14.2157 - deps: send@0.17.2158 * deps: setprototypeof@1.2.01591604.17.1 / 2019-05-25161===================162163 * Revert "Improve error message for `null`/`undefined` to `res.status`"
3473 unmodified lines
modified:package.json+22 added-21 removed
18 unmodified lines
19 "express",20 "framework",21 "sinatra",22 "web",23 "http",24 "rest",25 "restful",26 "router",27 "app",
1 unmodified line
29 ],30 "dependencies": {31 "accepts": "~1.3.7",32 "array-flatten": "2.1.1",32 "body-parser": "1.19.0",33 "content-disposition": "0.5.3",33 "body-parser": "1.19.1",34 "content-disposition": "0.5.4",35 "content-type": "~1.0.4",35 "cookie": "0.4.0",36 "cookie": "0.4.1",37 "cookie-signature": "1.0.6",38 "debug": "3.1.0",39 "depd": "~1.1.2",40 "encodeurl": "~1.0.2",
5 unmodified lines
46 "methods": "~1.1.2",47 "on-finished": "~2.3.0",48 "parseurl": "~1.3.3",49 "path-is-absolute": "1.0.1",49 "proxy-addr": "~2.0.5",50 "qs": "6.7.0",50 "proxy-addr": "~2.0.7",51 "qs": "6.9.6",52 "range-parser": "~1.2.1",53 "router": "2.0.0-alpha.1",53 "safe-buffer": "5.1.2",54 "send": "0.17.1",55 "serve-static": "1.14.1",56 "setprototypeof": "1.1.1",54 "safe-buffer": "5.2.1",55 "send": "0.17.2",56 "serve-static": "1.14.2",57 "setprototypeof": "1.2.0",58 "statuses": "~1.5.0",59 "type-is": "~1.6.18",60 "utils-merge": "1.0.1",61 "vary": "~1.1.2"62 },63 "devDependencies": {64 "after": "0.8.2",64 "connect-redis": "3.4.1",65 "cookie-parser": "~1.4.4",66 "cookie-session": "1.3.3",67 "ejs": "2.6.1",68 "eslint": "2.13.1",69 "express-session": "1.16.1",70 "hbs": "4.0.4",65 "connect-redis": "3.4.2",66 "cookie-parser": "1.4.6",67 "cookie-session": "2.0.0",68 "ejs": "3.1.6",69 "eslint": "7.32.0",70 "express-session": "1.17.2",71 "hbs": "4.2.0",72 "istanbul": "0.4.5",72 "marked": "0.6.2",73 "marked": "0.7.0",74 "method-override": "3.0.0",74 "mocha": "5.2.0",75 "morgan": "1.9.1",76 "multiparty": "4.2.1",75 "mocha": "9.1.3",76 "morgan": "1.10.0",77 "multiparty": "4.2.2",78 "pbkdf2-password": "1.2.1",79 "should": "13.2.3",79 "supertest": "3.3.0",80 "supertest": "6.1.6",81 "vhost": "~3.0.2"82 },83 "engines": {84 "node": ">= 0.10.0"
16 unmodified lines
modified:Readme.md+8 added-5 removed
2 unmodified lines
3 Fast, unopinionated, minimalist web framework for [node](http://nodejs.org).45 [![NPM Version][npm-image]][npm-url]6 [![NPM Downloads][downloads-image]][downloads-url]7 [![Linux Build][travis-image]][travis-url]7 [![Linux Build][ci-image]][ci-url]8 [![Windows Build][appveyor-image]][appveyor-url]9 [![Test Coverage][coveralls-image]][coveralls-url]1011```js
14 unmodified lines
2627Before installing, [download and install Node.js](https://nodejs.org/en/download/).28Node.js 0.10 or higher is required.2930If this is a brand new project, make sure to create a `package.json` first with31the [`npm init` command](https://docs.npmjs.com/creating-a-package-json-file).3233Installation is done using the34[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):3536```bash
60 unmodified lines
9798## Philosophy99100 The Express philosophy is to provide small, robust tooling for HTTP servers, making98 it a great solution for single page applications, web sites, hybrids, or public101 it a great solution for single page applications, websites, hybrids, or public102 HTTP APIs.103104 Express does not force you to use any specific ORM or template engine. With support for over105 14 template engines via [Consolidate.js](https://github.com/tj/consolidate.js),
39 unmodified lines
145## License146147 [MIT](LICENSE)148149[ci-image]: https://img.shields.io/github/workflow/status/expressjs/express/ci/master.svg?label=linux150[ci-url]: https://github.com/expressjs/express/actions?query=workflow%3Aci151[npm-image]: https://img.shields.io/npm/v/express.svg152[npm-url]: https://npmjs.org/package/express153[downloads-image]: https://img.shields.io/npm/dm/express.svg149[downloads-url]: https://npmjs.org/package/express150[travis-image]: https://img.shields.io/travis/expressjs/express/master.svg?label=linux151[travis-url]: https://travis-ci.org/expressjs/express154[downloads-url]: https://npmcharts.com/compare/express?minimal=true155[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/express/master.svg?label=windows156[appveyor-url]: https://ci.appveyor.com/project/dougwilson/express157[coveralls-image]: https://img.shields.io/coveralls/expressjs/express/master.svg158[coveralls-url]: https://coveralls.io/r/expressjs/express?branch=master
modified:Security.md+4 added
14 unmodified lines
15contributions.1617Report security bugs by emailing the lead maintainer in the Readme.md file.1819To ensure the timely response to your report, please ensure that the entirety20of the report is contained within the email body and not solely behind a web21link or an attachment.2223The lead maintainer will acknowledge your email within 48 hours, and will send a24more detailed response within 48 hours indicating the next steps in handling25your report. After the initial reply to your report, the security team will26endeavor to keep you informed of the progress towards a fix and full
21 unmodified lines
added:Triager-Guide.md+63 added
1# Express Triager Guide23## Issue Triage Process45When a new issue or pull request is opened the issue will be labeled with `needs triage`.6If a triage team member is available they can help make sure all the required information7is provided. Depending on the issue or PR there are several next labels they can add for further8classification:910* `needs triage`: This can be kept if the triager is unsure which next steps to take11* `awaiting more info`: If more info has been requested from the author, apply this label.12* `question`: User questions that do not appear to be bugs or enhancements.13* `discuss`: Topics for discussion. Might end in an `enhancement` or `question` label.14* `bug`: Issues that present a reasonable conviction there is a reproducible bug.15* `enhancement`: Issues that are found to be a reasonable candidate feature additions.1617In all cases, issues may be closed by maintainers if they don't receive a timely response when18further information is sought, or when additional questions are asked.1920## Approaches and Best Practices for getting into triage contributions2122Review the organization's [StatusBoard](https://expressjs.github.io/statusboard/),23pay special attention to these columns: stars, watchers, open issues, and contributors.24This gives you a general idea about the criticality and health of the repository.25Pick a few projects based on that criteria, your interests, and skills (existing or aspiring).2627Review the project's contribution guideline if present. In a nutshell,28commit to the community's standards and values. Review the29documentation, for most of the projects it is just the README.md, and30make sure you understand the key APIs, semantics, configurations, and use cases.3132It might be helpful to write your own test apps to re-affirm your33understanding of the key functions. This may identify some gaps in34documentation, record those as they might be good PR's to open.35Skim through the issue backlog; identify low hanging issues and mostly new ones.36From those, attempt to recreate issues based on the OP description and37ask questions if required. No question is a bad question!3839## Removal of Triage Role4041There are a few cases where members can be removed as triagers:4243- Breaking the CoC or project contributor guidelines44- Abuse or misuse of the role as deemed by the TC45- Lack of participation for more than 6 months4647If any of these happen we will discuss as a part of the triage portion of the regular TC meetings.48If you have questions feel free to reach out to any of the TC members.4950## Other Helpful Hints:5152- Everyone is welcome to attend the [Express Technical Committee Meetings](https://github.com/expressjs/discussions#expressjs-tc-meetings), and as a triager, it might help to get a better idea of what's happening with the project.53- When exploring the module's functionality there are a few helpful steps:54 - Turn on `DEBUG=*` (see https://www.npmjs.com/package/debug) to get detailed log information55 - It is also a good idea to do live debugging to follow the control flow, try using `node --inspect`56 - It is a good idea to make at least one pass of reading through the entire source57- When reviewing the list of open issues there are some common types and suggested actions:58 - New/unattended issues or simple questions: A good place to start59 - Hard bugs & ongoing discussions: always feel free to chime in and help60 - Issues that imply gaps in the documentation: open PRs with changes or help the user to do so61- For recurring issues, it is helpful to create functional examples to demonstrate (publish as gists or a repo)62- Review and identify the maintainers. If necessary, at-mention one or more of them if you are unsure what to do63- Make sure all your interactions are professional, welcoming, and respectful to the parties involved.