Followup to #356 and #384
If we are going to serve console pages and the external API from the same server (Nexus), we need a way of distinguishing between the two sets of routes. More specifically, we need to be able to designate a catch-all route that matches all console URLs without matching any API routes.
In #384, we are able to cheat because all currently existing console routes start with /orgs, so we just use /orgs/* as the catchall route for console pages. This only works because a) there aren't any other console routes, and b) the API routes for orgs start with the full word /organizations. If we were to add console pages that don't start with /orgs OR shorten the API ones to /orgs (which we've discussed), we'd need another way of doing this.
A common approach is to put an /api prefix on all the API routes. This is the solution @zephraph and I lean toward, though to make it really clean we would want /* to match console routes, which would require Dropshot to allow overlapping route definitions (see oxidecomputer/dropshot#199).
On the other hand, we can avoid this problem entirely by serving console and nexus from different origins, but in order to do that we would have to solve #410.
Followup to #356 and #384
If we are going to serve console pages and the external API from the same server (Nexus), we need a way of distinguishing between the two sets of routes. More specifically, we need to be able to designate a catch-all route that matches all console URLs without matching any API routes.
In #384, we are able to cheat because all currently existing console routes start with
/orgs, so we just use/orgs/*as the catchall route for console pages. This only works because a) there aren't any other console routes, and b) the API routes for orgs start with the full word/organizations. If we were to add console pages that don't start with/orgsOR shorten the API ones to/orgs(which we've discussed), we'd need another way of doing this.A common approach is to put an
/apiprefix on all the API routes. This is the solution @zephraph and I lean toward, though to make it really clean we would want/*to match console routes, which would require Dropshot to allow overlapping route definitions (see oxidecomputer/dropshot#199).On the other hand, we can avoid this problem entirely by serving console and nexus from different origins, but in order to do that we would have to solve #410.