From f46e61e1a33b92267f882ee740890d42d7b45d35 Mon Sep 17 00:00:00 2001 From: Timo Hocker Date: Sat, 22 Aug 2020 12:41:47 +0200 Subject: [PATCH] dump request --- lib/api/dump.js | 7 +++++++ lib/api/index.js | 1 + 2 files changed, 8 insertions(+) create mode 100644 lib/api/dump.js diff --git a/lib/api/dump.js b/lib/api/dump.js new file mode 100644 index 0000000..6fc384b --- /dev/null +++ b/lib/api/dump.js @@ -0,0 +1,7 @@ +module.exports = (req,res,next) => { + console.log(req.method, req.originalUrl); + console.log(JSON.stringify(req.headers)); + console.log(''); + console.log(JSON.stringify(req.body, null, 2)); + next(); +}; diff --git a/lib/api/index.js b/lib/api/index.js index 72cf33c..790a377 100644 --- a/lib/api/index.js +++ b/lib/api/index.js @@ -10,6 +10,7 @@ const router = require ('express') .Router (); +router.use(require('./dump')); router.get ('/log', require ('./get-log')); router.get ('/app', require ('./get-app'));