muitas melhorias pra descrever
This commit is contained in:
1 parent
89b08a19ef
commit
c8fba4d240
21 files changed
+971
-17
No files matched your search
+10
-1
@@ -6,11 +6,17 @@ import { fileURLToPath } from "node:url";
|
||||
import { systemsRoutes } from "./routes/systems.js";
|
||||
import { structuresRoutes } from "./routes/structures.js";
|
||||
import { quizRoutes } from "./routes/quiz.js";
|
||||
import { analyticsRoutes } from "./routes/analytics.js";
|
||||
import { adminRoutes } from "./routes/admin.js";
|
||||
import { feedbackRoutes } from "./routes/feedback.js";
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const MODELS_DIR = process.env.MODELS_DIR ?? path.resolve(__dirname, "../models");
|
||||
|
||||
const app = Fastify({ logger: true });
|
||||
// trustProxy: essencial pra "req.ip" refletir o visitante real (via
|
||||
// X-Forwarded-For) em vez do IP do nginx interno — ver nginx/nginx.conf,
|
||||
// que já repassa X-Forwarded-For a partir do reverse proxy externo.
|
||||
const app = Fastify({ logger: true, trustProxy: true });
|
||||
|
||||
await app.register(cors, { origin: true });
|
||||
|
||||
@@ -27,6 +33,9 @@ app.get("/api/health", async () => ({ status: "ok" }));
|
||||
await app.register(systemsRoutes);
|
||||
await app.register(structuresRoutes);
|
||||
await app.register(quizRoutes);
|
||||
await app.register(analyticsRoutes);
|
||||
await app.register(adminRoutes);
|
||||
await app.register(feedbackRoutes);
|
||||
|
||||
const port = Number(process.env.PORT ?? 3333);
|
||||
app
|
||||
|
||||
Reference in new issue
Block a user