From 09931c78da5f2412188839da8d17a697073fb224 Mon Sep 17 00:00:00 2001 From: Stephan <57194608+stephan418@users.noreply.github.com> Date: Thu, 28 Apr 2022 13:51:10 +0200 Subject: [PATCH] Add logger and remove unused code --- src/app.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/app.ts b/src/app.ts index d821084..bda5053 100644 --- a/src/app.ts +++ b/src/app.ts @@ -34,17 +34,6 @@ async function main() { app.use(express.urlencoded({ extended: true })); app.use(express.json()); - app.use((err: any, req: Request, res: Response, next: NextFunction) => { - if (err) { - res.status(400).send({ - type: "error", - payload: "The body of your request did not contain valid data", - }); - } else { - next(); - } - }); - // Admin authentication endpoints app.use("/api/authentication", adminAuthRouter); @@ -65,10 +54,15 @@ async function main() { }); logger.info("Server started"); + + process.on("exit", () => { + logger.info("Server stopping..."); + }); } main() .catch((e) => { + logger.crit(e); throw e; }) .finally(async () => {