Updated some comments

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-10-06 16:11:49 -07:00
parent 5f6663675f
commit 186c5423bd

View File

@ -53,25 +53,30 @@ app.use(bodyParser.urlencoded({
extended: false extended: false
})); }));
/* ******************************************************************************* */ /* *******************************************************************************
/* Logging */ * Logging - begin
/* This runs before after cookie parsing, but before routes. If we set *
* immediate: true on the morgan options, it happens before cookie parsing */ * This runs before after cookie parsing, but before routes. If we set
* immediate: true on the morgan options, it happens before cookie parsing
* */
morgan.token('remote-user', function (req) { morgan.token('remote-user', function (req) {
return req.user ? req.user.username : "N/A"; return req.user ? req.user.username : "N/A";
}); });
/* Any path starting with the following won't be logged via morgan */
const logSkipPaths = new RegExp("^" + basePath + "(" + [ const logSkipPaths = new RegExp("^" + basePath + "(" + [
"bower_components", "bower_components",
].join(")|(") + ")"); ].join(")|(") + ")");
console.log(logSkipPaths);
app.use(morgan('common', { app.use(morgan('common', {
skip: function (req) { skip: function (req) {
return logSkipPaths.exec(req.originalUrl); return logSkipPaths.exec(req.originalUrl);
} }
})); }));
/* Logging */
/* ******************************************************************************* */ /*
* Logging - end
* ******************************************************************************* */
/* body-parser does not support text/*, so add support for that here */ /* body-parser does not support text/*, so add support for that here */
app.use(function(req, res, next){ app.use(function(req, res, next){