From aa21ca9b40a50d2a9e801f98cf39caaecf0bbc66 Mon Sep 17 00:00:00 2001 From: Nadim Ritter Date: Fri, 23 Aug 2024 11:01:02 +0200 Subject: [PATCH] revert changes --- server/src/app.ts | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/server/src/app.ts b/server/src/app.ts index 0e87be0..8144ed6 100644 --- a/server/src/app.ts +++ b/server/src/app.ts @@ -14,40 +14,28 @@ import * as ENV from "./config/envConfig"; const app: Express = express(); const port: string = ENV.SERVER_PORT; -const viewPath: string = __dirname + "/views/"; -const distPath: string = __dirname + "/dist/"; +const path: string = __dirname + "/views/"; -// Get environment mode for local dev and set CORS options +//get environment mode for local dev and set cors options LOG.info("env mode: " + ENV.NODE_ENV); if(ENV.NODE_ENV === "dev"){ app.use(cors(getCorstOptions())) } -//server static files -app.use(express.static(viewPath)); -app.use(ENV.BASE_PATH, express.static(distPath)); - -//parse incoming requests +app.use(express.static(path)); app.use(bodyParser.json()); - -//middleware and routes config app.use(apiRequestLogger); + app.use(authorizationRoutes); app.use(routes); -// Serve the index.html for the root path -app.get("/", (req: Request, res: Response) => { - res.sendFile(viewPath + "index.html"); -}); -// Serve the index.html for custom path -app.get(ENV.BASE_PATH + "/*", (req: Request, res: Response) => { - res.sendFile(distPath + "index.html"); +app.get("/", (req: Request, res: Response) => { + res.sendFile(path + "index.html"); }); -//fallback route, SPA routing app.get("*", (req: Request, res: Response) => { - res.sendFile(viewPath + "index.html"); + res.sendFile(path + "index.html"); }); app.listen(port, () => {