Rework authentication
This commit is contained in:
parent
a85330e8cf
commit
c07d33bcc9
17 changed files with 317 additions and 128 deletions
14
src/index.ts
14
src/index.ts
|
|
@ -1,6 +1,11 @@
|
|||
import Fastify from "fastify";
|
||||
import cors from "@fastify/cors";
|
||||
import cookie from "@fastify/cookie";
|
||||
|
||||
import { config } from "./config.js";
|
||||
|
||||
import Fastify from "fastify";
|
||||
import { getCookieSecret } from "./services/auth/helpers.js";
|
||||
|
||||
import { testRoutes } from "./controllers/test/routes.js";
|
||||
import { authRoutes } from "./controllers/auth/routes.js";
|
||||
import { userRoutes } from "./controllers/user/routes.js";
|
||||
|
|
@ -14,6 +19,13 @@ const app = Fastify({
|
|||
logger: true,
|
||||
});
|
||||
|
||||
app.register(cors, {
|
||||
origin: "http://localhost:3000",
|
||||
credentials: true,
|
||||
});
|
||||
|
||||
app.register(cookie, { secret: getCookieSecret() });
|
||||
|
||||
app.register(testRoutes);
|
||||
app.register(authRoutes, { prefix: "/api/v1/auth" });
|
||||
app.register(userRoutes, { prefix: "/api/v1/user" });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue