aboutsummaryrefslogtreecommitdiffstats
path: root/middleware/logger.js
diff options
context:
space:
mode:
authorWilliam Harrington <kb0iic@berzerkula.org>2019-04-17 22:05:03 -0500
committerWilliam Harrington <kb0iic@berzerkula.org>2019-04-17 22:05:03 -0500
commitbe62cdbbb12e064cc14e8d6bd8d732cd183a05c3 (patch)
tree9540ef1f3e766e8ef9152b90a51ab3680d3f4980 /middleware/logger.js
parentb6eeec9203a1a2c76e8eebf8fc9ea6406f63afcd (diff)
Export logger and require moment in logger. Require middleware/logger in index.
Diffstat (limited to 'middleware/logger.js')
-rw-r--r--middleware/logger.js12
1 files changed, 12 insertions, 0 deletions
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;