diff options
author | William Harrington <kb0iic@berzerkula.org> | 2019-04-17 21:59:22 -0500 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2019-04-17 21:59:22 -0500 |
commit | e719de425d7607368d530373002d8f550747fb79 (patch) | |
tree | 6fd650012b1859030f9501af3b2ace62d659ecb6 /index.js | |
parent | fda25494564015e0fdaa7742746ca0fbb7185f80 (diff) |
Install moment and utilize it in logger to add timestamp after url.
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1,13 +1,18 @@ const express = require('express'); const path = require('path'); 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}`); + console.log( + `${req.protocol}://${req.get('host')}${ + req.originalUrl + }: ${moment().format()}` + ); next(); -} +}; // Init middleware app.use(logger); |