From 2850d82238a00684139934f0f323c139331b4549 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 30 Nov 2023 10:10:51 +0700 Subject: [PATCH] fix: cannot reach api endpoint --- Services/server/src/app.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Services/server/src/app.ts b/Services/server/src/app.ts index 33ad44b..d67c922 100644 --- a/Services/server/src/app.ts +++ b/Services/server/src/app.ts @@ -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`); });