Skip to content

Commit

Permalink
Merge pull request bitrocks#29 from nervosnetwork/log-rpc-method
Browse files Browse the repository at this point in the history
chore: Log rpc method by default
  • Loading branch information
RetricSu authored Jul 19, 2021
2 parents 7678ed8 + c1396c0 commit ff7da81
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 ff7da81

Please sign in to comment.