As the title says, I have a Next.js app and the pages of it are served to the client from an express backend routing (don't ask me why I'm using next instead of regular react for this, I know it kind of defeats the purpose of next). I have a page set up for dynamic routing:
/fabric/[fabricCode]
Ideally the user would be able to follow a link to this page and be able to go directly to the link if inputted into the address bar. Right now, if a person clicks on a fabric from the search it will send them to the correct fabric page "/fabric/XXXX". However, if I refresh that page or if a I type that address directly into the address bar, it says:
Cannot GET /fabric/XXXX/
I'm not sure what the issue is, but here is my routing for the client side:
app.use(express.static(path.join(__dirname, "../Client/out")));
app.get("/", (req, res) => {
res.sendFile(path.join(__dirname, "../Client/out"));
});
app.get("*", (req, res) => {
res.sendFile(path.join(__dirname, "../Client/out"));
});
My Next.js app is built and then exported to the "out" folder in "Client". Anyone have a fix?