BeaconCMS/beacon

Support mixed routes

Opened this issue · 0 comments

The beacon_site macro injects the following catch-all route into the host app router:

live "/*path", BeaconWeb.PageLive, :path

Which makes it hard to mix and match beacon pages with regular non-beacon pages from the host application. For example suppose one wants to have this route:

live /:username, MyAppWeb.UsersLive

But at the same time serve beacon pages at the root as:

beacon_site "/"

So if beacon_site "/" comes first it would match mysite.com/username and return 404 since there's no beacon page for the path /username or it would never match the beacon page /about if live /:username comes first.


A possible solution is letting Beacon manage all routes in the app, including the routes defined in the host app. Putting beacon_site at the top will match all request (catch-all) and if Beacon doesn't find a page then it forwards the request to the host app's Router.