To support front-end routing, Bones has a catch-all route which sends the index page back to the client (at which point React-Router takes over and navigates to the right component).
A downside of this is that any resources not found on the server turn into 200 responses with an index HTML body. This is confusing for students.
A clunky solution for this is to have an explicit array of client-side routes maintained on the server side, all of which send back the index page.
A better solution involves using/sharing React code server-side — possibly even with some server-side rendering (!) to show the user a correct page template before front-end code takes over. The routes component can be read in by the server and used to handle requests for client-side routes. Some research should be done to see how React-Router v4 factors into this potential solution.
Either way, this would allow genuine 404s again, leading to a more pleasant and understandable development experience.
To support front-end routing, Bones has a catch-all route which sends the index page back to the client (at which point React-Router takes over and navigates to the right component).
A downside of this is that any resources not found on the server turn into 200 responses with an index HTML body. This is confusing for students.
A clunky solution for this is to have an explicit array of client-side routes maintained on the server side, all of which send back the index page.
A better solution involves using/sharing React code server-side — possibly even with some server-side rendering (!) to show the user a correct page template before front-end code takes over. The routes component can be read in by the server and used to handle requests for client-side routes. Some research should be done to see how React-Router v4 factors into this potential solution.
Either way, this would allow genuine 404s again, leading to a more pleasant and understandable development experience.