Open cszczepaniak opened 3 years ago
After some research and tinkering, I found the reason for this:
func (cs *cribbageServer) addReactHandlers(router *gin.Engine) {
// Serve frontend React static files
router.Use(static.Serve(`/`, static.LocalFile(`./client/build`, true)))
}
We serve the react application from exactly one route: /
When the user types /register
into their browser (or clicks an <a>
element, which is what the mentioned link is), gin doesn't map it to the react app, but instead looks for a matching route. The fix would be to match any path from the browser and route them to /
, but matching any path means potential conflicts with existing API (or WASM) routes.
My recommendation is to do the following:
docker-compose
anyway, we should just build a separate frontend container that serves the react app separately from the API. If we want to preserve WASM, maybe the same would work? Unclear.
On the login page, we have a link that is supposed to take you to the register page. Right now it gives you a 404. Also, adding
/register
to the URL also gives a 404, but clicking the register button in the left drawer does work. Make everything not be broken.