From be62cdbbb12e064cc14e8d6bd8d732cd183a05c3 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Wed, 17 Apr 2019 22:05:03 -0500 Subject: Export logger and require moment in logger. Require middleware/logger in index. --- middleware/logger.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'middleware/logger.js') diff --git a/middleware/logger.js b/middleware/logger.js index e69de29..bc7012e 100644 --- a/middleware/logger.js +++ b/middleware/logger.js @@ -0,0 +1,12 @@ +const moment = require('moment'); + +const logger = (req, res, next) => { + console.log( + `${req.protocol}://${req.get('host')}${ + req.originalUrl + }: ${moment().format()}` + ); + next(); +}; + +module.exports = logger; -- cgit v1.2.3-54-g00ecf