Added request logging
This commit is contained in:
parent
67909bc71a
commit
796d519c31
10
index.js
10
index.js
@ -57,8 +57,18 @@ async function asyncMain()
|
||||
|
||||
const app = express();
|
||||
|
||||
|
||||
const logMiddleware = (req, res, next) =>
|
||||
{
|
||||
// TODO merge with api.js' version
|
||||
const ip = req.headers['x-forwarded-for'] || req.ip;
|
||||
logger.verbose(`[${ip}] ${req.path} (body = ${JSON.stringify(req.body)})`);
|
||||
next()
|
||||
}
|
||||
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: false }));
|
||||
app.use(logMiddleware);
|
||||
|
||||
app.use('/api', container.ApiRoutes.createRouter(express));
|
||||
app.use('/', express.static('frontend/dist'));
|
||||
|
Loading…
Reference in New Issue
Block a user