From c1396c0cdaca0573a595b3547492077a02283578 Mon Sep 17 00:00:00 2001 From: classicalliu Date: Mon, 19 Jul 2021 11:39:09 +0800 Subject: [PATCH] chore: Log rpc method by default --- packages/api-server/app.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/api-server/app.js b/packages/api-server/app.js index 7260404..6de43f9 100644 --- a/packages/api-server/app.js +++ b/packages/api-server/app.js @@ -18,6 +18,15 @@ app.use(express.json()); app.use(cors(corsOptions)); app.use(express.urlencoded({ extended: false })); +app.use(function (req, _res, next) { + if (process.env.WEB3_LOG_REQUEST_BODY) { + console.log("request.body:", req.body); + } else { + console.log("request.method:", req.body.method); + } + next(); +}); + app.use("/", jaysonMiddleware); // catch 404 and forward to error handler