Skip to content

Commit

Permalink
ci: share server public folder + fix 403 error on each react app relo…
Browse files Browse the repository at this point in the history
…ading
  • Loading branch information
dlavaury committed Feb 10, 2024
1 parent 5da3f00 commit bbafd9f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions server/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,23 @@ app.use("/api", apiRouter);
// 2. Ensure that the `reactBuildPath` points to the correct directory where your client's build artifacts are located.

/*
const reactBuildPath = `${__dirname}/../../client/dist`;
const path = require("path");
const reactBuildPath = path.join(__dirname, "/../../client/dist");
const publicFolderPatch = path.join(__dirname, "/../public");
// Serve react resources
app.use(express.static(reactBuildPath));
// Serve server resources
app.get("*.*", express.static(publicFolderPatch, { maxAge: "1y" }));
// Redirect unhandled requests to the react index file
app.get("*", (req, res) => {
res.sendFile("index.html", { root: reactBuildPath } );
app.get("*", (_, res) => {
res.sendFile(path.join(reactBuildPath, "/index.html"));
});
*/

Expand Down

0 comments on commit bbafd9f

Please sign in to comment.