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
Provenance
- Commit
c7d528c- Tree
f361379- Author
Douglas Christopher Wilson <doug@somethingdoug.com>- Committer
Douglas Christopher Wilson <doug@somethingdoug.com>- Parent 1
8aabeca- Parent 2
ea537d9
61 files changed+847 added−227 removed
added:.github/workflows/ci.yml+160 added
1+name: ci2+3+on:4+- pull_request5+- push6+7+jobs: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.x30+31+ include:32+ - name: Node.js 0.1033+ node-version: "0.10"34+ npm-i: mocha@3.5.3 supertest@2.0.035+36+ - name: Node.js 0.1237+ node-version: "0.12"38+ npm-i: mocha@3.5.3 supertest@2.0.039+40+ - name: io.js 1.x41+ node-version: "1.8"42+ npm-i: mocha@3.5.3 supertest@2.0.043+44+ - name: io.js 2.x45+ node-version: "2.5"46+ npm-i: mocha@3.5.3 supertest@2.0.047+48+ - name: io.js 3.x49+ node-version: "3.3"50+ npm-i: mocha@3.5.3 supertest@2.0.051+52+ - name: Node.js 4.x53+ node-version: "4.9"54+ npm-i: mocha@5.2.0 supertest@3.4.255+56+ - name: Node.js 5.x57+ node-version: "5.12"58+ npm-i: mocha@5.2.0 supertest@3.4.259+60+ - name: Node.js 6.x61+ node-version: "6.17"62+ npm-i: mocha@6.2.263+64+ - name: Node.js 7.x65+ node-version: "7.10"66+ npm-i: mocha@6.2.267+68+ - name: Node.js 8.x69+ node-version: "8.17"70+ npm-i: mocha@7.2.071+72+ - name: Node.js 9.x73+ node-version: "9.11"74+ npm-i: mocha@7.2.075+76+ - name: Node.js 10.x77+ node-version: "10.24"78+ npm-i: mocha@8.4.079+80+ - name: Node.js 11.x81+ node-version: "11.15"82+ npm-i: mocha@8.4.083+84+ - name: Node.js 12.x85+ node-version: "12.22"86+87+ - name: Node.js 13.x88+ node-version: "13.14"89+90+ - name: Node.js 14.x91+ node-version: "14.18"92+93+ steps:94+ - uses: actions/checkout@v295+96+ - 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"101+102+ - name: Configure npm103+ run: |104+ npm config set loglevel error105+ npm config set shrinkwrap false106+107+ - name: Install npm module(s) ${{ matrix.npm-i }}108+ run: npm install --save-dev ${{ matrix.npm-i }}109+ if: matrix.npm-i != ''110+111+ - name: Remove non-test dependencies112+ run: npm rm --silent --save-dev connect-redis113+114+ - 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+ fi125+126+ - name: Install Node.js dependencies127+ run: npm install128+129+ - name: List environment130+ id: list_env131+ shell: bash132+ run: |133+ echo "node@$(node -v)"134+ echo "npm@$(npm -v)"135+ npm -s ls ||:136+137+ - name: Run tests138+ shell: bash139+ run: npm run test-ci140+141+ - name: Lint code142+ if: steps.list_env.outputs.eslint != ''143+ run: npm run lint144+145+ - 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: true151+152+ 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: truemodified: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 linesmodified:examples/auth/views/login.ejs+2 added-3 removed
1 2-<% var title = 'Authentication Example' %>3-<% include head %>2+<%- include('head', { title: 'Authentication Example' }) -%>3 4 <h1>Login</h1>5 <%- message %>6 Try accessing <a href="/restricted">/restricted</a>, then authenticate with "tj" and "foobar".10 unmodified lines17 <input type="submit" value="Login">18 </p>19 </form>20 22-<% include foot %>21+<%- include('foot') -%>added:examples/downloads/files/notes/groceries.txt+3 added
1+* milk2+* eggs3+* breadmodified:examples/downloads/index.js+6 added-5 removed
5 unmodified lines678910111213141011121314151617181917 unmodified lines5 unmodified linesvar path = require('path');var app = module.exports = express();
app.get('/', function(req, res){ res.send('<ul>' + '<li>Download <a href="/files/amazing.txt">amazing.txt</a>.</li>' + '<li>Download <a href="/files/missing.txt">missing.txt</a>.</li>' + '<li>Download <a href="/files/CCTV大赛上海分赛区.txt">CCTV大赛上海分赛区.txt</a>.</li>' + '</ul>'); res.send('<ul>' + '<li>Download <a href="/files/notes/groceries.txt">notes/groceries.txt</a>.</li>' + '<li>Download <a href="/files/amazing.txt">amazing.txt</a>.</li>' + '<li>Download <a href="/files/missing.txt">missing.txt</a>.</li>' + '<li>Download <a href="/files/CCTV大赛上海分赛区.txt">CCTV大赛上海分赛区.txt</a>.</li>' + '</ul>')});
// /files/* is accessed via req.params[0]// but here we name it :file17 unmodified linesmodified:examples/ejs/public/stylesheets/style.css+1 added-1 removed
12334body { padding: 50px 80px; font: 14px "Helvetica Nueue", "Lucida Grande", Arial, sans-serif; font: 14px "Helvetica Neue", "Lucida Grande", Arial, sans-serif;}modified:examples/ejs/views/header.html+1 added
123456789<!DOCTYPE html><html lang="en"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title><%= title %></title> <link rel="stylesheet" href="/stylesheets/style.css"></head><body>modified:examples/ejs/views/users.html+2 added-2 removed
11234567891010<% include header.html %><%- include('header.html') -%>
<h1>Users</h1><ul id="users"> <% users.forEach(function(user){ %> <li><%= user.name %> <<%= user.email %>></li> <% }) %></ul>
<% include footer.html %><%- include('footer.html') -%>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>8 9 <body>1 unmodified linemodified: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>8 9 <body>11 unmodified linesmodified: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 linesmodified: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 linesmodified: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 linesmodified: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 linesmodified: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 linesmodified: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 linesmodified: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 linesmodified:examples/params/index.js+1 added-1 removed
6 unmodified lines7 8 // Faux database9 10 var users = [11- { name: 'tj' }11+ { name: 'tj' }12 , { name: 'tobi' }13 , { name: 'loki' }14 , { name: 'jane' }15 , { name: 'bandit' }63 unmodified linesmodified:examples/resource/index.js+1 added-1 removed
24 unmodified lines25 26 // Fake records27 28 var users = [29- { name: 'tj' }29+ { name: 'tj' }30 , { name: 'ciaran' }31 , { name: 'aaron' }32 , { name: 'guillermo' }33 , { name: 'simon' }60 unmodified linesmodified:examples/route-map/index.js+4 added-3 removed
1 /**2 * Module dependencies.3 */4 5+var escapeHtml = require('escape-html')6 var express = require('../../lib/express');7 8 var verbose = process.env.NODE_ENV !== 'test'9 21 unmodified lines31 res.send('user list');32 },33 34 get: function(req, res){34- res.send('user ' + req.params.uid);35+ res.send('user ' + escapeHtml(req.params.uid))36 },37 38 delete: function(req, res){39 res.send('delete users');1 unmodified line41 };42 43 var 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 },47 48 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 };52 53 app.map({20 unmodified linesmodified:examples/route-middleware/index.js+1 added-1 removed
13 unmodified lines14 // curl -X DELETE http://localhost:3000/user/0 (unauthorized since you are not an admin)15 16 // Dummy users17 var 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 linesmodified:examples/route-separation/views/posts/index.ejs+2 added-2 removed
1-<% include ../header %>1+<%- include('../header') -%>2 3 <h1>Posts</h1>4 5 <dl id="posts">2 unmodified lines8 <dd><%= post.body %></dd>9 <% }) %>10 </dl>11 12-<% include ../footer %>12+<%- include('../footer') -%>modified:examples/route-separation/views/users/edit.ejs+2 added-2 removed
1-<% include ../header %>1+<%- include('../header') -%>2 3 <h1>Editing <%= user.name %></h1>4 5 <div id="user">13 unmodified lines19 </p>20 </form>21 </div>22 23-<% include ../footer %>23+<%- include('../footer') -%>modified:examples/route-separation/views/users/index.ejs+2 added-2 removed
1-<% include ../header %>1+<%- include('../header') -%>2 3 <h1><%= title %></h1>4 5 <div id="users">4 unmodified lines10 </li>11 <% }) %>12 </div>13 14-<% include ../footer %>14+<%- include('../footer') -%>modified:examples/route-separation/views/users/view.ejs+2 added-2 removed
1-<% include ../header %>1+<%- include('../header') -%>2 3 <h1><%= user.name %></h1>4 5 <div id="user">6 <p>Email: <%= user.email %></p>7 </div>8 9-<% 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') -%>2 3 <h1><%= title %></h1>4 5 <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>9 10-<% 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 linesmodified: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 linesmodified:examples/web-service/index.js+3 added-3 removed
6 unmodified lines7 var app = module.exports = express();8 9 // 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)12 13 function error(status, msg) {14 var err = new Error(msg);15 err.status = status;38 unmodified lines54 { name: 'cluster', url: 'https://github.com/learnboost/cluster' }55 ];56 57 var users = [58- { name: 'tobi' }58+ { name: 'tobi' }59 , { name: 'loki' }60 , { name: 'jane' }61 ];62 41 unmodified lines104 // it will be the last middleware called, if all others105 // invoke next() and do not respond.106 app.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 });110 111 /* istanbul ignore next */112 if (!module.parent) {3 unmodified linesadded:examples/README.md+30 added
1+# Express examples2+3+This page contains list of examples using Express.4+5+- [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 servicemodified:lib/application.js+1 added-1 removed
270 unmodified lines271 *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 template351 unmodified linesmodified:lib/request.js+1 added-1 removed
228 unmodified lines229 });230 231 /**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-8278 unmodified linesmodified:lib/response.js+13 added-8 removed
264 unmodified lines265 266 // restrict callback charset267 callback = callback.replace(/[^\[\]\w$.]/g, '');268 269+ 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+ }278 279 // 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 lines312 * 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 lines499 * '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 lines602 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 }608 609 return this.set(field, value);610 };376 unmodified lines987 var json = replacer || spaces988 ? JSON.stringify(value, replacer, spaces)989 : JSON.stringify(value);990 986- 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 linesmodified:lib/utils.js+2 added-6 removed
115 unmodified lines116 }117 118 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 lines148 }149 150 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 linesmodified:test/acceptance/cookie-sessions.js+1 added-1 removed
11 unmodified lines12 13 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 })19 20 it('should display 1 view on revisit', function (done) {18 unmodified linesmodified:test/acceptance/downloads.js+9 added
9 unmodified lines10 .expect(/href="\/files\/amazing.txt"/, done)11 })12 })13 14+ 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+ })22+23 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 linesmodified:test/acceptance/web-service.js+3 added-3 removed
95 unmodified lines96 97 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 lines25 res.send('tobi');26 });27 28 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 linesmodified:test/app.listen.js-4 removed
3 unmodified lines4 describe('app.listen()', function(){5 it('should wrap with an HTTP server', function(done){6 var app = express();7 8- app.get('/tobi', function(req, res){9- res.end('got tobi!');10- });11-8 var server = app.listen(9999, function(){9 server.close();10 done();11 });2 unmodified linesmodified:test/app.param.js+1 added-1 removed
142 unmodified lines143 next();144 });145 146 app.param('user', function(req, res, next, user) {147- next(new Error('invalid invokation'));147+ next(new Error('invalid invocation'))148 });149 150 app.post('/:user', function(req, res, next) {151 res.send(req.params.user);174 unmodified linesmodified:test/app.router.js+29 added
186 unmodified lines187 request(app)188 .get('/user/10/edit')189 .expect('editing user 10', done);190 })191+192+ it.skip('should ensure regexp matches path prefix', function (done) {193+ var app = express()194+ var p = []195+196+ 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+ })211+212+ 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 })221 222 describe('case sensitivity', function(){223 it('should be disabled by default', function(done){1018 unmodified linesmodified:test/express.static.js+2 added-2 removed
427 unmodified lines428 })429 430 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 })439 440 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 linesmodified:test/res.cookie.js+13 added
113 unmodified lines114 request(app)115 .get('/')116 .expect(200, optionsCopy, done)117 })118+119+ it('should throw an error with invalid maxAge', function (done) {120+ var app = express()121+122+ app.use(function (req, res) {123+ res.cookie('name', 'tobi', { maxAge: 'foobar' })124+ res.end()125+ })126+127+ request(app)128+ .get('/')129+ .expect(500, /option maxAge is invalid/, done)130+ })131 })132 133 describe('signed', function(){134 it('should generate a signed JSON cookie', function(done){53 unmodified linesmodified:test/res.json.js+15 added
120 unmodified lines121 .get('/')122 .expect('Content-Type', 'application/json; charset=utf-8')123 .expect(200, '{"\\u0026":"\\u003cscript\\u003e"}', done)124 })125+126+ it('should not break undefined escape', function (done) {127+ var app = express()128+129+ app.enable('json escape')130+131+ app.use(function (req, res) {132+ res.json(undefined)133+ })134+135+ request(app)136+ .get('/')137+ .expect('Content-Type', 'application/json; charset=utf-8')138+ .expect(200, '', done)139+ })140 })141 142 describe('"json replacer" setting', function(){143 it('should be passed to JSON.stringify()', function(done){42 unmodified linesmodified:test/res.jsonp.js+71 added-52 removed
154 unmodified lines155 .expect('X-Content-Type-Options', 'nosniff')156 .expect(200, /cb\(\{"hello":"world"\}\);$/, done);157 })158 159- 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()162 163- app.use(function(req, res){164- res.jsonp(null);165- });163+ app.use(function (req, res) {164+ res.jsonp(undefined)165+ })166 167 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 })173 174- 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()177 178- app.use(function(req, res){179- res.jsonp(['foo', 'bar', 'baz']);180- });178+ app.use(function (req, res) {179+ res.jsonp(null)180+ })181 182 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 })188 189- 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()192 193- app.use(function(req, res){194- res.jsonp({ name: 'tobi' });195- });193+ app.use(function (req, res) {194+ res.jsonp('tobi')195+ })196 197 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 })203 204- 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()207 208- app.use(function(req, res){209- res.jsonp(null);210- });208+ app.use(function (req, res) {209+ res.jsonp(42)210+ })211 212 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+ })218 219+ 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()222 221- app.use(function(req, res){222- res.jsonp(300);223- });223+ app.use(function (req, res) {224+ res.jsonp(['foo', 'bar', 'baz'])225+ })226 227 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+ })233 234+ 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()237 234- app.use(function(req, res){235- res.jsonp('str');236- });238+ app.use(function (req, res) {239+ res.jsonp({ name: 'tobi' })240+ })241 242 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 })248 249 describe('"json escape" setting', function () {15 unmodified lines265 .get('/?callback=foo')266 .expect('Content-Type', 'text/javascript; charset=utf-8')267 .expect(200, /foo\({"\\u0026":"\\u2028\\u003cscript\\u003e\\u2029"}\)/, done)268 })269+270+ it('should not break undefined escape', function (done) {271+ var app = express()272+273+ app.enable('json escape')274+275+ app.use(function (req, res) {276+ res.jsonp(undefined)277+ })278+279+ request(app)280+ .get('/?callback=cb')281+ .expect('Content-Type', 'text/javascript; charset=utf-8')282+ .expect(200, /cb\(\)/, done)283+ })284 })285 286 describe('"json replacer" setting', function(){287 it('should be passed to JSON.stringify()', function(done){56 unmodified linesmodified:test/Router.js+3 added-3 removed
30 unmodified lines31 var router = new Router();32 var another = new Router();33 34 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 lines43 it('should handle blank URL', function(done){44 var router = new Router();45 46 router.use(function (req, res) {47- false.should.be.true()47+ throw new Error('should not be called')48 });49 50 router.handle({ url: '', method: 'GET' }, {}, done);51 });32 unmodified lines84 });85 86 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 linesmodified:.eslintrc.yml+1 added-1 removed
1 unmodified line2 3 rules: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
1-language: node_js2-node_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"17-matrix: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"24-sudo: false25-cache:26- directories:27- - node_modules28-before_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- fi57-script:58- # Run test script59- - npm run test-ci60- # Run linting61- - npm run lint62-after_script:63- - |64- # Upload coverage to coveralls65- npm install --save-dev coveralls@2.12.066- coveralls < ./coverage/lcov.infomodified:appveyor.yml+28 added-9 removed
7 unmodified lines8 - 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"19 cache:20 - node_modules21 install:22 # Install Node.js1 unmodified line24 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_modules10 unmodified lines79 node --version80 npm --version81 # Run test script82 - npm run test-ci62- # Run linting63- - npm run lint83 version: "{build}"added:Charter.md+92 added
1+# Express Charter2+3+## Section 0: Guiding Principles4+5+The Express project is part of the OpenJS Foundation which operates6+transparently, openly, collaboratively, and ethically.7+Project proposals, timelines, and status must not merely be open, but8+also easily visible to outsiders.9+10+## Section 1: Scope11+12+Express is a http web server framework with a simple and expressive API13+which is highly aligned with Node.js core. We aim to be the best in14+class for writing performant, spec compliant, and powerful web servers15+in Node.js. As one of the oldest and most popular web frameworks in16+the ecosystem, we have an important place for new users and experts17+alike.18+19+### 1.1: In-scope20+21+Express is made of many modules spread between three GitHub Orgs:22+23+- [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 libraries28+29+### 1.2: Out-of-Scope30+31+Section Intentionally Left Blank32+33+## Section 2: Relationship with OpenJS Foundation CPC.34+35+Technical leadership for the projects within the OpenJS Foundation is36+delegated to the projects through their project charters by the OpenJS37+Cross Project Council (CPC). In the case of the Express project, it is38+delegated to the Express Technical Committee ("TC").39+40+This Technical Committee is in charge of both the day-to-day operations41+of the project, as well as its technical management. This charter can42+be amended by the TC requiring at least two approvals and a minimum two43+week comment period for other TC members or CPC members to object. Any44+changes the CPC wishes to propose will be considered a priority but45+will follow the same process.46+47+### 2.1 Other Formal Project Relationships48+49+Section Intentionally Left Blank50+51+## Section 3: Express Governing Body52+53+The Express project is managed by the Technical Committee ("TC").54+Members can be added to the TC at any time. Any committer can nominate55+another committer to the TC and the TC uses its standard consensus56+seeking process to evaluate whether or not to add this new member.57+Members who do not participate consistently at the level of a majority58+of the other members are expected to resign.59+60+## Section 4: Roles & Responsibilities61+62+The Express TC manages all aspects of both the technical and community63+parts of the project. Members of the TC should attend the regular64+meetings when possible, and be available for discussion of time65+sensitive or important issues.66+67+### Section 4.1 Project Operations & Management68+69+Section Intentionally Left Blank70+71+### Section 4.2: Decision-making, Voting, and/or Elections72+73+The Express TC uses a "consensus seeking" process for issues that are74+escalated to the TC. The group tries to find a resolution that has no75+open objections among TC members. If a consensus cannot be reached76+that has no objections then a majority wins vote is called. It is also77+expected that the majority of decisions made by the TC are via a78+consensus seeking process and that voting is only used as a last-resort.79+80+Resolution may involve returning the issue to committers with81+suggestions on how to move forward towards a consensus. It is not82+expected that a meeting of the TC will resolve all issues on its83+agenda during that meeting and may prefer to continue the discussion84+happening among the committers.85+86+### Section 4.3: Other Project Roles87+88+Section Intentionally Left Blank89+90+## Section 5: Definitions91+92+Section Intentionally Left Blankadded:Code-Of-Conduct.md+139 added
1+# Contributor Covenant Code of Conduct2+3+As a member of the Open JS Foundation, Express has adopted the4+[Contributor Covenant 2.0][cc-20-doc].5+6+If an issue arises and you cannot resolve it directly with the parties7+involved, you can report it to the Express project TC through the following8+email: express-coc@lists.openjsf.org9+10+In addition, the OpenJS Foundation maintains a Code of Conduct Panel (CoCP).11+This is a foundation-wide team established to manage escalation when a reporter12+believes that a report to a member project or the CPC has not been properly13+handled. In order to escalate to the CoCP send an email to14+coc-escalation@lists.openjsf.org.15+16+## Our Pledge17+18+We as members, contributors, and leaders pledge to make participation in our19+community a harassment-free experience for everyone, regardless of age, body20+size, visible or invisible disability, ethnicity, sex characteristics, gender21+identity and expression, level of experience, education, socio-economic status,22+nationality, personal appearance, race, religion, or sexual identity and23+orientation.24+25+We pledge to act and interact in ways that contribute to an open, welcoming,26+diverse, inclusive, and healthy community.27+28+## Our Standards29+30+Examples of behavior that contributes to a positive environment for our31+community include:32+33+* 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+ community40+41+Examples of unacceptable behavior include:42+43+* 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 setting51+52+## Enforcement Responsibilities53+54+Community leaders are responsible for clarifying and enforcing our standards of55+acceptable behavior and will take appropriate and fair corrective action in56+response to any behavior that they deem inappropriate, threatening, offensive,57+or harmful.58+59+Community leaders have the right and responsibility to remove, edit, or reject60+comments, commits, code, wiki edits, issues, and other contributions that are61+not aligned to this Code of Conduct, and will communicate reasons for62+moderation decisions when appropriate.63+64+## Scope65+66+This Code of Conduct applies within all community spaces, and also applies when67+an individual is officially representing the community in public spaces.68+Examples of representing our community include using an official e-mail69+address, posting via an official social media account, or acting as an70+appointed representative at an online or offline event.71+72+## Enforcement73+74+Instances of abusive, harassing, or otherwise unacceptable behavior may be75+reported to the community leaders responsible for enforcement at76+express-coc@lists.openjsf.org. All complaints will be reviewed and77+investigated promptly and fairly.78+79+All community leaders are obligated to respect the privacy and security of the80+reporter of any incident.81+82+## Enforcement Guidelines83+84+Community leaders will follow these Community Impact Guidelines in determining85+the consequences for any action they deem in violation of this Code of Conduct:86+87+### 1. Correction88+89+**Community Impact**: Use of inappropriate language or other behavior deemed90+unprofessional or unwelcome in the community.91+92+**Consequence**: A private, written warning from community leaders, providing93+clarity around the nature of the violation and an explanation of why the94+behavior was inappropriate. A public apology may be requested.95+96+### 2. Warning97+98+**Community Impact**: A violation through a single incident or series of99+actions.100+101+**Consequence**: A warning with consequences for continued behavior. No102+interaction with the people involved, including unsolicited interaction with103+those enforcing the Code of Conduct, for a specified period of time. This104+includes avoiding interactions in community spaces as well as external channels105+like social media. Violating these terms may lead to a temporary or permanent106+ban.107+108+### 3. Temporary Ban109+110+**Community Impact**: A serious violation of community standards, including111+sustained inappropriate behavior.112+113+**Consequence**: A temporary ban from any sort of interaction or public114+communication with the community for a specified period of time. No public or115+private interaction with the people involved, including unsolicited116+interaction with those enforcing the Code of Conduct, is allowed during this117+period. Violating these terms may lead to a permanent ban.118+119+### 4. Permanent Ban120+121+**Community Impact**: Demonstrating a pattern of violation of community122+standards, including sustained inappropriate behavior, harassment of an123+individual, or aggression toward or disparagement of classes of individuals.124+125+**Consequence**: A permanent ban from any sort of public interaction within the126+project community.127+128+## Attribution129+130+This Code of Conduct is adapted from the [Contributor Covenant, version 2.0](cc-20-doc).131+132+Community Impact Guidelines were inspired by133+[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).134+135+[cc-20-doc]: https://www.contributor-covenant.org/version/2/0/code_of_conduct/136+137+For answers to common questions about this code of conduct, see the FAQ at138+https://www.contributor-covenant.org/faq. Translations are available at139+https://www.contributor-covenant.org/translations.modified:Collaborator-Guide.md+2 added-1 removed
1+# Express Collaborator Guide2 3 ## Website Issues4 5 Open issues for the expressjs.com website in https://github.com/expressjs/expressjs.com.15 unmodified lines21 ## Steps for contributing22 23 1. [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.24-2. Create your own [fork](https://github.com/expressjs/express) on github, then25+2. Create your own [fork](https://github.com/expressjs/express) on GitHub, then26 checkout your fork.27 3. 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.29 4. To run the test suite, first install the dependencies by running `npm install`,22 unmodified linesmodified:Contributing.md+35 added-7 removed
12 unmodified lines13 * 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 technical16 expertise to resolve rare disputes.17+* A **Triager** is a subset of contributors who have been given triage access to the repository.18 18-# Logging Issues19+## Logging Issues20 21 Log an issue for any question or problem you might have. When in doubt, log an issue, and22 any additional policies about what to include will be provided in the responses. The only23 exception is security disclosures which should be sent privately.3 unmodified lines27 28 Please be courteous and respectful. Every participant is expected to follow the29 project's Code of Conduct.30 30-# Contributions31+## Contributions32 33 Any change to resources in this repository must be through pull requests. This applies to all changes34 to documentation, code, binary files, etc. Even long term committers and TC members must use35 pull requests.5 unmodified lines41 weekends and other holiday periods to ensure active committers all have reasonable time to42 become involved in the discussion and review process if they wish.43 44 The default for each contribution is that it is accepted once no committer has an objection.44-During review committers may also request that a specific contributor who is most versed in a45+During a review, committers may also request that a specific contributor who is most versed in a46 particular area gives a "LGTM" before the PR can be merged. There is no additional "sign off"47 process for contributions to land. Once all issues brought by committers are addressed it can48 be landed by any committer.49 6 unmodified lines56 discuss pending contributions in order to find a resolution. It is expected that only a57 small minority of issues be brought to the TC for resolution and that discussion and58 compromise among committers be the default resolution mechanism.59 59-# Becoming a Committer60+## Becoming a Triager61 62+Anyone can become a triager! Read more about the process of being a triager in63+[the triage process document](Triager-Guide.md).64+65+[Open an issue in `expressjs/express` repo](https://github.com/expressjs/express/issues/new)66+to 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.68+69+Here is an example issue content you can copy and paste:70+71+```72+Title: Request triager role for <your GitHub username>73+74+I have read and understood the project's Code of Conduct.75+I also have read and understood the process and best practices around Express triaging.76+77+I request for a triager role for the following GitHub organizations:78+79+jshttp80+pillarjs81+express82+```83+84+Once you have opened your issue, a member of the TC will add you to the `triage` team in85+the organizations requested. They will then close the issue.86+87+Happy triaging!88+89+## Becoming a Committer90+91 All contributors who land a non-trivial contribution should be on-boarded in a timely manner,92 and added as a committer, and be given write access to the repository.93 94 Committers are expected to follow this policy and continue to send pull requests, go through95 proper review, and have other committers merge their pull requests.96 67-# TC Process97+## TC Process98 99 The TC uses a "consensus seeking" process for issues that are escalated to the TC.100 The group tries to find a resolution that has no open objections among TC members.101 If a consensus cannot be reached that has no objections then a majority wins vote8 unmodified lines110 Members can be added to the TC at any time. Any committer can nominate another committer111 to the TC and the TC uses its standard consensus seeking process to evaluate whether or112 not to add this new member. Members who do not participate consistently at the level of113 a majority of the other members are expected to resign.84-85-modified:History.md+38 added
1+5.x2+===3+4+This incorporates all changes after 4.17.1 up to 4.17.2.5+6 5.0.0-alpha.8 / 2020-03-257 ==========================8 9 This is the eighth Express 5.0 alpha release, based off 4.17.1 and includes113 unmodified lines123 - `req.query` is now a getter instead of a plain property124 * add:125 - `app.router` is a reference to the base router126 127+4.17.2 / 2021-12-16128+===================129+130+ * 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.0159+160 4.17.1 / 2019-05-25161 ===================162 163 * Revert "Improve error message for `null`/`undefined` to `res.status`"3473 unmodified linesmodified:package.json+22 added-21 removed
18 unmodified lines19 "express",20 "framework",21 "sinatra",22 "web",23+ "http",24 "rest",25 "restful",26 "router",27 "app",1 unmodified line29 ],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 lines46 "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 linesmodified:Readme.md+8 added-5 removed
2 unmodified lines3 Fast, unopinionated, minimalist web framework for [node](http://nodejs.org).4 5 [![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]10 11 ```js14 unmodified lines26 27 Before installing, [download and install Node.js](https://nodejs.org/en/download/).28 Node.js 0.10 or higher is required.29 30+If this is a brand new project, make sure to create a `package.json` first with31+the [`npm init` command](https://docs.npmjs.com/creating-a-package-json-file).32+33 Installation is done using the34 [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):35 36 ```bash60 unmodified lines97 98 ## Philosophy99 100 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.103 104 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 lines145 ## License146 147 [MIT](LICENSE)148 149+[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=mastermodified:Security.md+4 added
14 unmodified lines15 contributions.16 17 Report security bugs by emailing the lead maintainer in the Readme.md file.18 19+To ensure the timely response to your report, please ensure that the entirety20+of the report is contained within the email body and not solely behind a web21+link or an attachment.22+23 The lead maintainer will acknowledge your email within 48 hours, and will send a24 more detailed response within 48 hours indicating the next steps in handling25 your report. After the initial reply to your report, the security team will26 endeavor to keep you informed of the progress towards a fix and full21 unmodified linesadded:Triager-Guide.md+63 added
1+# Express Triager Guide2+3+## Issue Triage Process4+5+When a new issue or pull request is opened the issue will be labeled with `needs triage`.6+If a triage team member is available they can help make sure all the required information7+is provided. Depending on the issue or PR there are several next labels they can add for further8+classification:9+10+* `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.16+17+In all cases, issues may be closed by maintainers if they don't receive a timely response when18+further information is sought, or when additional questions are asked.19+20+## Approaches and Best Practices for getting into triage contributions21+22+Review the organization's [StatusBoard](https://expressjs.github.io/statusboard/),23+pay special attention to these columns: stars, watchers, open issues, and contributors.24+This gives you a general idea about the criticality and health of the repository.25+Pick a few projects based on that criteria, your interests, and skills (existing or aspiring).26+27+Review the project's contribution guideline if present. In a nutshell,28+commit to the community's standards and values. Review the29+documentation, for most of the projects it is just the README.md, and30+make sure you understand the key APIs, semantics, configurations, and use cases.31+32+It might be helpful to write your own test apps to re-affirm your33+understanding of the key functions. This may identify some gaps in34+documentation, record those as they might be good PR's to open.35+Skim through the issue backlog; identify low hanging issues and mostly new ones.36+From those, attempt to recreate issues based on the OP description and37+ask questions if required. No question is a bad question!38+39+## Removal of Triage Role40+41+There are a few cases where members can be removed as triagers:42+43+- 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 months46+47+If any of these happen we will discuss as a part of the triage portion of the regular TC meetings.48+If you have questions feel free to reach out to any of the TC members.49+50+## Other Helpful Hints:51+52+- 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.