diff options
author | BoHong Li | 2017-04-12 05:31:22 +0800 |
---|---|---|
committer | Raccoon Li | 2017-05-08 19:24:37 +0800 |
commit | 9f1f16c8e347f2bb2c0c6ab1b71c1a683a413a90 (patch) | |
tree | ac3f77d410aabc3944d5ed80236bd454b2794e99 | |
parent | dee77c459a929d7e0041fae38176b71248a9ff9c (diff) |
refactor(app.js): Extract urlencodedParser to utils module
Diffstat (limited to '')
-rw-r--r-- | app.js | 7 | ||||
-rw-r--r-- | lib/web/utils.js | 9 |
2 files changed, 10 insertions, 6 deletions
@@ -7,6 +7,7 @@ var passport = require('passport') var methodOverride = require('method-override') var cookieParser = require('cookie-parser') var bodyParser = require('body-parser') +const {urlencodedParser} = require('./lib/web/utils') var compression = require('compression') var session = require('express-session') var SequelizeStore = require('connect-session-sequelize')(session.Store) @@ -98,12 +99,6 @@ realtime.io = io // methodOverride app.use(methodOverride('_method')) -// create application/x-www-form-urlencoded parser -var urlencodedParser = bodyParser.urlencoded({ - extended: false, - limit: 1024 * 1024 * 10 // 10 mb -}) - // session store var sessionStore = new SequelizeStore({ db: models.sequelize diff --git a/lib/web/utils.js b/lib/web/utils.js new file mode 100644 index 00000000..c9016523 --- /dev/null +++ b/lib/web/utils.js @@ -0,0 +1,9 @@ +'use strict' + +const bodyParser = require('body-parser') + +// create application/x-www-form-urlencoded parser +exports.urlencodedParser = bodyParser.urlencoded({ + extended: false, + limit: 1024 * 1024 * 10 // 10 mb +}) |