I have written a REST api in Java and a turn based online client game that utilizes the api. When a player creates a new game instance, other players can join given the game id via a URL.
Instead of actually going to that invalid URL since no page is associated with it, How do I make it so that Player 2 will just go to the default page instead so that I can later grab the ID path variable and handle the joining process?
One: use a query parameter
Simply instead of
Two: setup webserver to serve the same file by pattern
This will depend on the webserver, but basically what you are doing is saying if request url is of a specific pattern serve that file.
For apache that would look something like:
RewriteRule ^(.*) index.html [NC,L]