mirror of
https://github.com/detleph/server.git
synced 2026-09-08 16:06:19 +02:00
Add logger and remove unused code
This commit is contained in:
+5
-11
@@ -34,17 +34,6 @@ async function main() {
|
|||||||
app.use(express.urlencoded({ extended: true }));
|
app.use(express.urlencoded({ extended: true }));
|
||||||
app.use(express.json());
|
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
|
// Admin authentication endpoints
|
||||||
app.use("/api/authentication", adminAuthRouter);
|
app.use("/api/authentication", adminAuthRouter);
|
||||||
|
|
||||||
@@ -65,10 +54,15 @@ async function main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
logger.info("Server started");
|
logger.info("Server started");
|
||||||
|
|
||||||
|
process.on("exit", () => {
|
||||||
|
logger.info("Server stopping...");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
logger.crit(e);
|
||||||
throw e;
|
throw e;
|
||||||
})
|
})
|
||||||
.finally(async () => {
|
.finally(async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user