Skip to content

Commit

Permalink
chore: Log rpc method by default
Browse files Browse the repository at this point in the history
  • Loading branch information
classicalliu committed Jul 19, 2021
1 parent 7678ed8 commit c1396c0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/api-server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c1396c0

Please sign in to comment.