Add session management

This commit is contained in:
2025-01-03 12:32:43 +05:30
parent 83786e2994
commit 14c9b0210c
12 changed files with 341 additions and 16 deletions

View File

@@ -1,4 +1,5 @@
import fastify from "fastify";
import cors from "@fastify/cors";
import multipart from "@fastify/multipart";
import routes from "./routes";
@@ -9,6 +10,8 @@ import { errorHandler } from "./utils/errors";
import { authorize } from "./auth";
import { permitSchemas } from "./permit/permit.schema";
import { fileSchemas } from "./file/file.schema";
import { oauth } from "./oauth";
import { authRoutes } from "./auth/auth.route";
const app = fastify({ logger: true });
@@ -16,9 +19,16 @@ app.get("/health", (req, res) => {
return { status: "OK" };
});
oauth(app);
app.decorate("authorize", authorize);
app.setErrorHandler(errorHandler);
app.register(cors, {
origin: [process.env.UI_DOMAIN || ""],
credentials: true,
});
app.register(multipart, { limits: { fileSize: 50000000 } });
app.register(authRoutes, { prefix: "/auth" });
app.register(routes, { prefix: "/api/v1" });
for (const schema of [