mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 11:26:15 +01:00
added basic CLS support with re-entrant transactions
This commit is contained in:
12
src/app.js
12
src/app.js
@@ -9,6 +9,7 @@ const session = require('express-session');
|
||||
const FileStore = require('session-file-store')(session);
|
||||
const os = require('os');
|
||||
const sessionSecret = require('./services/session_secret');
|
||||
const cls = require('./services/cls');
|
||||
|
||||
const app = express();
|
||||
|
||||
@@ -23,6 +24,17 @@ app.use((req, res, next) => {
|
||||
next();
|
||||
});
|
||||
|
||||
app.use((req, res, next) => {
|
||||
cls.namespace.bindEmitter(req);
|
||||
cls.namespace.bindEmitter(res);
|
||||
|
||||
cls.init(() => {
|
||||
cls.namespace.set("Hi");
|
||||
|
||||
next();
|
||||
});
|
||||
});
|
||||
|
||||
app.use(bodyParser.json({limit: '50mb'}));
|
||||
app.use(bodyParser.urlencoded({extended: false}));
|
||||
app.use(cookieParser());
|
||||
|
||||
Reference in New Issue
Block a user