Skip to content

Commit edf2855

Browse files
authored
🌱 Fix proxies for express server / prod build (#1288)
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 <[email protected]>
1 parent a9f64a7 commit edf2855

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

server/src/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ const port = 8080;
1717

1818
const app = express();
1919
app.use(cookieParser());
20-
app.use(express.json());
21-
app.engine("ejs", ejs.renderFile);
22-
app.set("views", pathToClientDist);
23-
24-
app.use(express.static(pathToClientDist));
2520

2621
// Setup proxy handling
2722
for (const proxyPath in proxyMap) {
2823
app.use(proxyPath, createProxyMiddleware(proxyMap[proxyPath]));
2924
}
3025

26+
app.engine("ejs", ejs.renderFile);
27+
app.use(express.json());
28+
app.set("views", pathToClientDist);
29+
app.use(express.static(pathToClientDist));
30+
3131
// Handle any request that hasn't already been handled by express.static or proxy
3232
app.get("*", (_, res) => {
3333
if (process.env.NODE_ENV === "development") {

0 commit comments

Comments
 (0)