fix: cannot reach api endpoint

This commit is contained in:
Methapon2001 2023-11-30 10:10:51 +07:00
parent 5bc3d5580e
commit 2850d82238
No known key found for this signature in database
GPG key ID: 849924FEF46BD132

View file

@ -19,7 +19,6 @@ if (process.env.NODE_ENV !== "production") app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(express.static("static"));
app.use("/docs", swaggerUi.serve, swaggerUi.setup(swaggerSpecs, { explorer: false }));
RegisterRoutes(router);
@ -27,8 +26,7 @@ RegisterRoutes(router);
app.use(swaggerSpecs.basePath, router);
app.use(errorHandler);
app.use(express.static("static"));
app.get("*", (_req, res) => {
app.use((_req, res, _next) => {
res.sendFile(`${process.cwd()}/static/index.html`);
});