Add access log widget
This commit is contained in:
parent
bc9a8283c6
commit
0a994e5b98
12 changed files with 181 additions and 0 deletions
|
|
@ -11,6 +11,7 @@ import * as morgan from 'morgan';
|
|||
import Accesses from 'accesses';
|
||||
import vhost = require('vhost');
|
||||
|
||||
import log from './log-request';
|
||||
import config from './conf';
|
||||
|
||||
/**
|
||||
|
|
@ -35,6 +36,11 @@ app.use(morgan(process.env.NODE_ENV == 'production' ? 'combined' : 'dev', {
|
|||
stream: config.accesslog ? fs.createWriteStream(config.accesslog) : null
|
||||
}));
|
||||
|
||||
app.use((req, res, next) => {
|
||||
log(req);
|
||||
next();
|
||||
});
|
||||
|
||||
// Drop request when without 'Host' header
|
||||
app.use((req, res, next) => {
|
||||
if (!req.headers['host']) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue