import ApplicationComponent from "../ApplicationComponent"; import onFinished from "on-finished"; import Logger from "../Logger"; import {Express, Router} from "express"; export default class LogRequestsComponent extends ApplicationComponent { public async start(app: Express, router: Router): Promise { router.use((req, res, next) => { onFinished(res, (err) => { if (!err) { Logger.info(`${req.method} ${req.originalUrl} - ${res.statusCode}`); } }); next(); }); } public async stop(): Promise { } }