experimental: api doc
This commit is contained in:
parent
25a20c4ad2
commit
cef53c0db9
3 changed files with 47 additions and 35 deletions
|
|
@ -1,13 +1,12 @@
|
|||
import "dotenv/config";
|
||||
import cors from "cors";
|
||||
import express, { json, urlencoded } from "express";
|
||||
import swaggerUi from "swagger-ui-express";
|
||||
import swaggerDocument from "./swagger.json";
|
||||
import error from "./middlewares/error";
|
||||
import morgan from "./middlewares/morgan";
|
||||
import { RegisterRoutes } from "./routes";
|
||||
import { initThailandAreaDatabase } from "./utils/thailand-area";
|
||||
import { initFirstAdmin } from "./utils/database";
|
||||
import { apiReference } from "@scalar/express-api-reference";
|
||||
|
||||
const APP_HOST = process.env.APP_HOST || "0.0.0.0";
|
||||
const APP_PORT = +(process.env.APP_PORT || 3000);
|
||||
|
|
@ -31,7 +30,7 @@ const APP_PORT = +(process.env.APP_PORT || 3000);
|
|||
app.use(morgan);
|
||||
|
||||
app.use("/", express.static("static"));
|
||||
app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(swaggerDocument));
|
||||
app.use("/api-docs", apiReference({ theme: "kepler", spec: { url: "/api/openapi" } }));
|
||||
|
||||
RegisterRoutes(app);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue