You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
464 B
JavaScript
21 lines
464 B
JavaScript
"use strict";
|
|
|
|
const util = require("util");
|
|
const chalk = require("chalk");
|
|
|
|
module.exports = function createDebugMiddleware() {
|
|
return function (req, res, next) {
|
|
console.log(`## ${chalk.cyan(req.method)} ${chalk.bold.yellow(req.url)}`);
|
|
|
|
console.log(util.inspect({
|
|
query: req.query,
|
|
params: req.params,
|
|
host: req.hostname,
|
|
headers: req.headers,
|
|
cookies: req.cookies,
|
|
body: req.body
|
|
}, {colors: true, depth: null}));
|
|
|
|
next();
|
|
}
|
|
}; |