Skip to content

Commit

Permalink
🌱 Fix proxies for express server / prod build (#1288)
Browse files Browse the repository at this point in the history
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 <sdickers@redhat.com>
  • Loading branch information
sjd78 committed Aug 15, 2023
1 parent a9f64a7 commit edf2855
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down

0 comments on commit edf2855

Please sign in to comment.