From 08d859ce9e9a8a8d975aab7654a4865426f038b1 Mon Sep 17 00:00:00 2001 From: Scott J Dickerson Date: Tue, 15 Aug 2023 14:52:19 -0400 Subject: [PATCH] Fix proxies for express server / prod build The order request handlers are added to the express server matters much more than anticipated. This rearrangement allows POST requests etc through the proxy to work again. Signed-off-by: Scott J Dickerson --- server/src/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/index.js b/server/src/index.js index 7dda15757..909124540 100644 --- a/server/src/index.js +++ b/server/src/index.js @@ -17,17 +17,17 @@ const port = 8080; const app = express(); app.use(cookieParser()); -app.use(express.json()); -app.engine("ejs", ejs.renderFile); -app.set("views", pathToClientDist); - -app.use(express.static(pathToClientDist)); // Setup proxy handling for (const proxyPath in proxyMap) { app.use(proxyPath, createProxyMiddleware(proxyMap[proxyPath])); } +app.engine("ejs", ejs.renderFile); +app.use(express.json()); +app.set("views", pathToClientDist); +app.use(express.static(pathToClientDist)); + // Handle any request that hasn't already been handled by express.static or proxy app.get("*", (_, res) => { if (process.env.NODE_ENV === "development") {