diff --git a/app.js b/app.js index c18e01fa..b00f37b4 100644 --- a/app.js +++ b/app.js @@ -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 +})