From a22c00fcefa10a99505c05393106fb3a655de243 Mon Sep 17 00:00:00 2001 From: Rory& Date: Sun, 1 Jun 2025 04:40:09 +0200 Subject: Add register with validation --- src/api/start.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/api/start.js') 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}`); }); -- cgit 1.5.1