diff options
-rw-r--r-- | index.js | 11 | ||||
-rw-r--r-- | middleware/logger.js | 12 |
2 files changed, 13 insertions, 10 deletions
@@ -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; |