aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.js11
-rw-r--r--middleware/logger.js12
2 files changed, 13 insertions, 10 deletions
diff --git a/index.js b/index.js
index 4721f34..cd6783c 100644
--- a/index.js
+++ b/index.js
@@ -1,19 +1,10 @@
const express = require('express');
const path = require('path');
+const logger = require('./middleware/logger.js');
const members = require('./Members.js');
-const moment = require('moment');
const app = express();
-const logger = (req, res, next) => {
- console.log(
- `${req.protocol}://${req.get('host')}${
- req.originalUrl
- }: ${moment().format()}`
- );
- next();
-};
-
// Init middleware
app.use(logger);
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;