1 files changed, 5 insertions, 1 deletions
diff --git a/src/api/start.js b/src/api/start.js
index 6f57afd..dcd5cf3 100644
--- a/src/api/start.js
+++ b/src/api/start.js
@@ -2,7 +2,8 @@ import express from 'express';
import { registerRoutes } from './routes.js';
import { useCors, useLogging } from './middlewares/index.js';
import { initDb } from '#db/index.js';
-import {initJwt} from "#util/index.js";
+import { initJwt } from '#util/index.js';
+import { handleErrors } from '#api/middlewares/errorMiddleware.js';
const app = express();
const PORT = process.env.PORT ?? 3000;
@@ -15,6 +16,7 @@ await initJwt();
app.use(express.json());
app.use(useCors);
app.disable('x-powered-by');
+app.set('json spaces', 2);
if (logRequests) {
app.use(useLogging(logRequests));
@@ -22,6 +24,8 @@ if (logRequests) {
registerRoutes(app);
+app.use(handleErrors);
+
app.listen(PORT, () => {
console.log(`Server is running on http://localhost:${PORT}`);
});
|