Skip to content

Commit

Permalink
Upgrade the backend deps
Browse files Browse the repository at this point in the history
* This removes all known current deprecated deps found in express 3
* *body-parser* offers some native limits for form bodies sent... so mirroring that to transfer size upload limit
* Using some package defaults to eliminate 3 new deprecation messages
* Update README.md to reflect

Since *morgan* is the *express* endorsed request logger this closes #394 ... reopen if we need another/different one or to configure a written log.
  • Loading branch information
Martii committed Nov 10, 2014
1 parent 851fdfa commit f3233de
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 9 deletions.
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ Repository | Reference | Recent Version
[ace-builds][ace-buildsGHUrl][¹][aceGHUrl] | [Documentation][ace-buildsDOCUrl][¹][aceDOCUrl] | [1.1.8 7fafd12][ace-buildsGHHASHUrl]
[async][asyncGHUrl] | [Documentation][asyncDOCUrl] | [![NPM version][asyncNPMVersionImage]][asyncNPMUrl]
[aws-sdk][aws-sdkGHUrl] | [Documentation][aws-sdkDOCUrl] | [![NPM version][aws-sdkNPMVersionImage]][aws-sdkNPMUrl]
[body-parser][body-parserGHUrl] | [Documentation][body-parserDOCUrl] | [![NPM version][body-parserNPMVersionImage]][body-parserNPMUrl]
[bootstrap][bootstrapGHUrl] | [Documentation][bootstrapDOCUrl] | [![NPM version][bootstrapNPMVersionImage]][bootstrapNPMUrl]
[bootstrap-markdown][bootstrap-markdownGHUrl] | [Documentation][bootstrap-markdownDOCUrl] | [![NPM version][bootstrap-markdownNPMVersionImage]][bootstrap-markdownNPMUrl]
[compression][compressionGHUrl] | [Documentation][compressionDOCUrl] | [![NPM version][compressionNPMVersionImage]][compressionNPMUrl]
[connect-mongo][connect-mongoGHUrl] | [Documentation][connect-mongoDOCUrl] | [![NPM version][connect-mongoNPMVersionImage]][connect-mongoNPMUrl]
[cookie-parser][cookie-parserGHUrl] | [Documentation][cookie-parserDOCUrl] | [![NPM version][cookie-parserNPMVersionImage]][cookie-parserNPMUrl]
[express][expressGHUrl] | [Documentation][expressDOCUrl] | [![NPM version][expressNPMVersionImage]][expressNPMUrl]
[express-session][express-sessionGHUrl] | [Documentation][express-sessionDOCUrl] | [![NPM version][express-sessionNPMVersionImage]][express-sessionNPMUrl]
[fakes3][fakes3GHUrl] | [Documentation][fakes3DOCUrl] | [![GEM version][fakes3GEMVersionImage]][fakes3GEMUrl]
[font-awesome][font-awesomeGHUrl] | [Documentation][font-awesomeDOCUrl] | [![NPM version][font-awesomeNPMVersionImage]][font-awesomeNPMUrl]
[formidable][formidableGHUrl] | [Documentation][formidableDOCUrl] | [![NPM version][formidableNPMVersionImage]][formidableNPMUrl]
Expand All @@ -42,6 +46,7 @@ Repository | Reference | Recent Version
[marked][markedGHUrl] | [Documentation][markedDOCUrl] | [![NPM version][markedNPMVersionImage]][markedNPMUrl]
[moment][momentGHUrl] | [Documentation][momentDOCUrl] | [![NPM version][momentNPMVersionImage]][momentNPMUrl]
[mongoose][mongooseGHUrl] | [Documentation][mongooseDOCUrl] | [![NPM version][mongooseNPMVersionImage]][mongooseNPMUrl]
[morgan][morganGHUrl] | [Documentation][morganDOCUrl] | [![NPM version][morganNPMVersionImage]][morganNPMUrl]
[mu2][mu2GHUrl] | [Documentation][mu2DOCUrl] | [![NPM version][mu2NPMVersionImage]][mu2NpmUrl]
[octicons][OcticonsGHUrl] | [Documentation][OcticonsDOCUrl] | [2.1.2 835ee02][OcticonsGHHASHUrl]
[passport][passportGHUrl] | [Documentation][passportDOCUrl] | [![NPM version][passportNPMVersionImage]][passportNPMUrl]
Expand All @@ -66,6 +71,7 @@ Repository | Reference | Recent Version
[sanitize-html][sanitize-htmlGHUrl] | [Documentation][sanitize-htmlDOCUrl] | [![NPM version][sanitize-htmlNPMVersionImage]][sanitize-htmlNPMUrl]
[select2][select2GHUrl] | [Documentation][select2DOCUrl] | [![NPM version][select2NPMVersionImage]][select2NPMUrl]
[select2-bootstrap-css][select2-bootstrap-cssGHUrl] | [Documentation][select2-bootstrap-cssDOCUrl] | [1.4.1 fce5f9f][select2-bootstrap-cssGHHASHUrl]
[serve-favicon][serve-faviconGHUrl] | [Documentation][serve-faviconDOCUrl] | [![NPM version][serve-faviconNPMVersionImage]][serve-faviconNPMUrl]
[underscore][underscoreGHUrl] | [Documentation][underscoreDOCUrl] | [![NPM version][underscoreNPMVersionImage]][underscoreNPMUrl]


Expand Down Expand Up @@ -117,6 +123,11 @@ Repository | Reference | Recent Version | Referenced
[aws-sdkNPMUrl]: https://npmjs.org/package/aws-sdk
[aws-sdkNPMVersionImage]: https://img.shields.io/npm/v/aws-sdk.svg?style=flat

[body-parserGHUrl]: https://github.com/expressjs/body-parser
[body-parserDOCUrl]: https://github.com/expressjs/body-parser/blob/master/README.md
[body-parserNPMUrl]: https://npmjs.org/package/body-parser
[body-parserNPMVersionImage]: https://img.shields.io/npm/v/body-parser.svg?style=flat

[bootstrapUrl]: http://getbootstrap.com/
[bootstrapGHUrl]: https://github.com/twbs/bootstrap
[bootstrapDOCUrl]: http://getbootstrap.com/components/
Expand All @@ -128,16 +139,31 @@ Repository | Reference | Recent Version | Referenced
[bootstrap-markdownNPMUrl]: https://www.npmjs.org/package/bootstrap-markdown
[bootstrap-markdownNPMVersionImage]: https://img.shields.io/npm/v/bootstrap-markdown.svg?style=flat

[compressionGHUrl]: https://github.com/expressjs/compression
[compressionDOCUrl]: https://github.com/expressjs/compression/blob/master/README.md
[compressionNPMUrl]: https://npmjs.org/package/compression
[compressionNPMVersionImage]: https://img.shields.io/npm/v/compression.svg?style=flat

[connect-mongoGHUrl]: https://github.com/kcbanner/connect-mongo
[connect-mongoDOCUrl]: https://github.com/kcbanner/connect-mongo/blob/master/Readme.md
[connect-mongoNPMUrl]: https://npmjs.org/package/connect-mongo
[connect-mongoNPMVersionImage]: https://img.shields.io/npm/v/connect-mongo.svg?style=flat

[cookie-parserGHUrl]: https://github.com/expressjs/cookie-parser
[cookie-parserDOCUrl]: https://github.com/expressjs/cookie-parser/blob/master/README.md
[cookie-parserNPMUrl]: https://npmjs.org/package/cookie-parser
[cookie-parserNPMVersionImage]: https://img.shields.io/npm/v/cookie-parser.svg?style=flat

[expressGHUrl]: https://github.com/strongloop/express
[expressDOCUrl]: http://expressjs.com/
[expressNPMUrl]: https://www.npmjs.org/package/express
[expressNPMVersionImage]: https://img.shields.io/npm/v/express.svg?style=flat

[express-sessionGHUrl]: https://github.com/expressjs/session
[express-sessionDOCUrl]: https://github.com/expressjs/session/blob/master/README.md
[express-sessionNPMUrl]: https://npmjs.org/package/express-session
[express-sessionNPMVersionImage]: https://img.shields.io/npm/v/express-session.svg?style=flat

[fakes3GHUrl]: https://github.com/jubos/fake-s3
[fakes3DOCUrl]: http://www.rubydoc.info/gems/fakes3
[fakes3GEMUrl]: http://rubygems.org/gems/fakes3
Expand Down Expand Up @@ -184,6 +210,11 @@ Repository | Reference | Recent Version | Referenced
[mongooseNPMUrl]: https://npmjs.org/package/mongoose
[mongooseNPMVersionImage]: https://img.shields.io/npm/v/mongoose.svg?style=flat

[morganGHUrl]: https://github.com/expressjs/morgan
[morganDOCUrl]: https://github.com/expressjs/morgan/blob/master/README.md
[morganNPMUrl]: https://npmjs.org/package/morgan
[morganNPMVersionImage]: https://img.shields.io/npm/v/morgan.svg?style=flat

[mu2GHUrl]: https://github.com/raycmorgan/Mu
[mu2DOCUrl]: https://github.com/raycmorgan/Mu/blob/master/README.md
[mu2NPMUrl]: https://www.npmjs.org/package/mu2
Expand Down Expand Up @@ -303,13 +334,17 @@ Repository | Reference | Recent Version | Referenced
[select2-bootstrap-cssDOCUrl]: https://github.com/t0m/select2-bootstrap-css/blob/bootstrap3/README.md
[select2-bootstrap-cssGHHASHUrl]: https://github.com/t0m/select2-bootstrap-css/blob/fce5f9f984b0cc6c8483ce7225ad2639f3a4dae5/select2-bootstrap.css

[serve-faviconGHUrl]: https://github.com/expressjs/serve-favicon
[serve-faviconDOCUrl]: https://github.com/expressjs/serve-favicon/blob/master/README.md
[serve-faviconNPMUrl]: https://npmjs.org/package/serve-favicon
[serve-faviconNPMVersionImage]: https://img.shields.io/npm/v/serve-favicon.svg?style=flat

[underscoreGHUrl]: https://github.com/jashkenas/underscore
[underscoreDOCUrl]: http://underscorejs.org/
[underscoreNPMUrl]: https://npmjs.org/package/underscore
[underscoreNPMVersionImage]: https://img.shields.io/npm/v/underscore.svg?style=flat



[bootswatchGHUrl]: https://github.com/thomaspark/bootswatch/blob/gh-pages/custom/bootstrap.css
[bootswatchREPOUrl]: http://bootswatch.com
[bootswatchNPMUrl]: https://www.npmjs.org/package/bootswatch
Expand Down
33 changes: 25 additions & 8 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@

var express = require('express');
var methodOverride = require('method-override');
var morgan = require('morgan');
var bodyParser = require('body-parser');
var compression = require('compression');
var cookieParser = require('cookie-parser');
var favicon = require('serve-favicon');

var minify = require('express-minify');
var MongoStore = require('connect-mongo')(express);
var session = require('express-session');
var MongoStore = require('connect-mongo')(session);
var mongoose = require('mongoose');
var passport = require('passport');

Expand Down Expand Up @@ -45,24 +52,34 @@ if (app.get('port') === 443) {
}

if (process.env.NODE_ENV !== 'production') {
app.use(express.logger('dev'));
app.use(morgan('dev'));
}

app.use(express.urlencoded());
app.use(express.json());
app.use(express.compress());
app.use(bodyParser.urlencoded({
extended: false,
limit: parseInt(settings.maximum_upload_script_size / 1024, 10) + 'kb'

This comment has been minimized.

Copy link
@Zren

Zren Nov 20, 2014

Contributor

Why do we need to bump the size of the requests parsed? Does this affect the script submission form?

https://github.com/expressjs/body-parser
This does not handle multipart bodies, due to their complex and typically large nature. For multipart bodies, you may be interested in the following modules:

I thought the script source code fell under the "form multipart body" section? Does it not?

This comment has been minimized.

Copy link
@Martii

Martii Nov 20, 2014

Member

Does this affect the script submission form?

Yes... otherwise the body buffer is quite small... CI didn't even write online to upload and that's not very big.

express 4 has a few different defaults than 3.


Forward ref #793

}));

app.use(bodyParser.json({
extended: false,
limit: parseInt(settings.maximum_upload_script_size / 1024, 10) + 'kb'
}));

app.use(compression());
app.use(methodOverride('X-HTTP-Method-Override'));

// Order is very important here (i.e mess with at your own risk)
app.use(express.cookieParser());
app.use(express.session({
app.use(cookieParser());
app.use(session({
resave: true,
saveUninitialized: true,
secret: sessionSecret,
store: sessionStore
}));
app.use(passport.initialize());
app.use(modifySessions.init(sessionStore));
app.use(app.router);
app.use(express.favicon('public/images/favicon.ico'));
app.use(favicon(__dirname + '/public/images/favicon.ico'));

// Set up the views
app.engine('html', require('./libs/muExpress').renderFile(app));
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
"ace-builds": "git://github.com/ajaxorg/ace-builds#7fafd12",
"async": "0.9.0",
"aws-sdk": "2.0.21",
"body-parser": "1.9.2",
"bootstrap": "3.1.1",
"bootstrap-markdown": "2.7.0",
"compression": "1.2.0",
"connect-mongo": "0.4.1",
"cookie-parser": "1.3.3",
"express": "3.18.2",
"express-minify": "0.0.11",
"express-session": "1.9.1",
"font-awesome": "4.2.0",
"formidable": "1.0.15",
"github": "0.2.2",
Expand All @@ -21,6 +25,7 @@
"method-override": "2.3.0",
"moment": "2.8.3",
"mongoose": "3.8.19",
"morgan": "1.5.0",
"mu2": "0.5.20",
"octicons": "git://github.com/github/octicons.git#835ee02",
"passport": "0.2.1",
Expand All @@ -45,6 +50,7 @@
"sanitize-html": "1.4.3",
"select2": "3.5.1",
"select2-bootstrap-css": "git://github.com/t0m/select2-bootstrap-css#fce5f9f",
"serve-favicon": "2.1.6",
"underscore": "1.7.0"
},
"repository": {
Expand Down

0 comments on commit f3233de

Please sign in to comment.