upgrade express

This commit is contained in:
Shane Kilkelly 2020-03-19 15:20:32 +00:00
parent aa324a1920
commit f069a2515d
4 changed files with 269 additions and 442 deletions

View file

@ -21,15 +21,14 @@ mongojs = require "./app/js/mongojs"
async = require "async" async = require "async"
Path = require "path" Path = require "path"
bodyParser = require "body-parser"
Metrics.mongodb.monitor(Path.resolve(__dirname + "/node_modules/mongojs/node_modules/mongodb"), logger) Metrics.mongodb.monitor(Path.resolve(__dirname + "/node_modules/mongojs/node_modules/mongodb"), logger)
Metrics.event_loop.monitor(logger, 100) Metrics.event_loop.monitor(logger, 100)
app = express() app = express()
app.configure -> app.use(Metrics.http.monitor(logger));
app.use(Metrics.http.monitor(logger)); app.use bodyParser({limit: (Settings.max_doc_length + 64 * 1024)})
app.use express.bodyParser({limit: (Settings.max_doc_length + 64 * 1024)})
app.use app.router
Metrics.injectMetricsRoute(app) Metrics.injectMetricsRoute(app)
DispatchManager.createAndStartDispatchers(Settings.dispatcherCount || 10) DispatchManager.createAndStartDispatchers(Settings.dispatcherCount || 10)

File diff suppressed because it is too large Load diff

View file

@ -21,9 +21,10 @@
}, },
"dependencies": { "dependencies": {
"async": "^2.5.0", "async": "^2.5.0",
"body-parser": "^1.19.0",
"bunyan": "~0.22.1", "bunyan": "~0.22.1",
"coffee-script": "~1.7.0", "coffee-script": "~1.7.0",
"express": "3.11.0", "express": "4.17.1",
"lodash": "^4.17.13", "lodash": "^4.17.13",
"logger-sharelatex": "^1.7.0", "logger-sharelatex": "^1.7.0",
"metrics-sharelatex": "^2.5.1", "metrics-sharelatex": "^2.5.1",

View file

@ -1,4 +1,5 @@
express = require("express") express = require("express")
bodyParser = require("body-parser")
app = express() app = express()
MAX_REQUEST_SIZE = 2*(2*1024*1024 + 64*1024) MAX_REQUEST_SIZE = 2*(2*1024*1024 + 64*1024)
@ -36,7 +37,7 @@ module.exports = MockWebApi =
else else
res.send 404 res.send 404
app.post "/project/:project_id/doc/:doc_id", express.bodyParser({limit: MAX_REQUEST_SIZE}), (req, res, next) => app.post "/project/:project_id/doc/:doc_id", bodyParser({limit: MAX_REQUEST_SIZE}), (req, res, next) =>
MockWebApi.setDocument req.params.project_id, req.params.doc_id, req.body.lines, req.body.version, req.body.ranges, req.body.lastUpdatedAt, req.body.lastUpdatedBy, (error) -> MockWebApi.setDocument req.params.project_id, req.params.doc_id, req.body.lines, req.body.version, req.body.ranges, req.body.lastUpdatedAt, req.body.lastUpdatedBy, (error) ->
if error? if error?
res.send 500 res.send 500