express-api-base/middleware/logRoute.js

13 lines
278 B
JavaScript
Raw Normal View History

2024-06-28 09:20:46 +00:00
'use strict'
const { logMessage } = require("../lib/logger")
// Dependencies
const logRoute = async (req, res, next) => {
logMessage(`${req.originalUrl}`, `\nHeaders: ${JSON.stringify(req.headers)}\nBody: ${JSON.stringify(req.body)}`)
next()
}
module.exports = logRoute