From 6e72cdb88934c840b3f08934baa3bd03b925506f Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Wed, 4 Sep 2024 07:40:04 -0600 Subject: [PATCH] Add request logging --- index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.js b/index.js index 9378af2..28090c7 100644 --- a/index.js +++ b/index.js @@ -10,6 +10,12 @@ const ws_ = []; const app = express(); app.set('trust proxy', true); +app.use((req, res, next) => { + // Request logger for debugging + console.log(`[${new Date().toLocaleString()}] ${req.method} ${req.path} from ${req.ip} with ${JSON.stringify(req.body)}`); + next(); +}); + app.put('/api/connect/:jobid', (req, res) => { var id = btoa(Crypto.randomBytes(10).toString('base64').slice(0, 10)).replaceAll("=", ""); ws_[id] = {};