fix DB setup

This commit is contained in:
zadam
2020-06-20 21:42:41 +02:00
parent 6207203b35
commit 027afab6b1
19 changed files with 133 additions and 118 deletions

View File

@@ -80,6 +80,8 @@ function apiRoute(method, path, routeHandler) {
function route(method, path, middleware, routeHandler, resultHandler, transactional = true) {
router[method](path, ...middleware, (req, res, next) => {
const start = Date.now();
try {
cls.namespace.bindEmitter(req);
cls.namespace.bindEmitter(res);
@@ -103,6 +105,12 @@ function route(method, path, middleware, routeHandler, resultHandler, transactio
res.sendStatus(500);
}
const time = Date.now() - start;
if (time >= 10) {
console.log(`Slow request: ${time}ms - ${method} ${path}`);
}
});
}