From f777b059b47a9b834d7b7a5461408e8fc21bbe45 Mon Sep 17 00:00:00 2001 From: Christian Gawron Date: Wed, 13 Mar 2024 22:42:15 +0000 Subject: [PATCH] log stream --- index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 5362e48..9ac9561 100644 --- a/index.js +++ b/index.js @@ -125,6 +125,16 @@ app.get('/user', (req, res) => { res.send(req.user); }); +app.use((req, res, next) => { + res.on('data', (chunk) => { + console.log('chunk', chunk.toString()); + }) + res.on('end', () => { + console.log('end'); + }) + next() +}) + app.use(`${PREFIX}*`, proxy(API_URL, { https: true, @@ -146,8 +156,6 @@ app.use(`${PREFIX}*`, console.log('body', srcReq.body); return proxyReqOpts; } - }).on('data', (data) => { - console.log('Data:', data); }) );