chore: update deps and api docs config

This commit is contained in:
Methapon2001 2025-02-20 10:44:28 +07:00
parent f914849431
commit e34ba9a239
3 changed files with 27 additions and 23 deletions

View file

@ -6,7 +6,6 @@ import morgan from "./middlewares/morgan";
import { RegisterRoutes } from "./routes";
import { initEmploymentOffice, initThailandAreaDatabase } from "./utils/thailand-area";
import { initFirstAdmin } from "./utils/database";
import { apiReference } from "@scalar/express-api-reference";
import { initSchedule } from "./services/schedule";
const APP_HOST = process.env.APP_HOST || "0.0.0.0";
@ -24,8 +23,7 @@ const APP_PORT = +(process.env.APP_PORT || 3000);
const originalSend = app.response.json;
app.response.json = function (body: unknown) {
this.app.locals.response = body;
return originalSend.call(this, body);
return originalSend.call(this, (this.app.locals.response = body));
};
app.use(cors());
@ -36,12 +34,18 @@ const APP_PORT = +(process.env.APP_PORT || 3000);
app.use("/", express.static("static"));
app.use(
"/api-docs",
apiReference({
theme: "kepler",
layout: "classic",
spec: { url: "/api/openapi" },
cdn: "https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.74",
}),
await import("@scalar/express-api-reference").then(({ apiReference }) =>
apiReference({
theme: "kepler",
layout: "classic",
hideModels: true,
hideClientButton: true,
customCss: `.endpoint-label-name { display: none }`,
spec: { url: "/api/openapi" },
}),
),
);
RegisterRoutes(app);