I'm building a yesod app which consists of two parts. The rest api (yesod) and the client side (angularjs).
Besides being a rest api, yesod also send the initial html to the client to start up angularjs. I have it working like this:
config/routes:
/user GET
/someOtherEntity GET POST
/ HomeR GET --route to send the html
Handler/Home.hs
getHomeR :: Handler Html
getHomeR = sendFile typeHtml "frontend/build/index.html"
As long as the first url is www.mydomain.com/ this works fine, but when I go to www.mydomain/some-angular/route I get a 404 from yesod.
I've tried this:
/#Text HomeR GET
This works fine for /my-angular-route, but breaks on /my-angular-route/param. I could add /#Text/#Text I suppose, but surely there's a cleaner way of handling this.
How can I implement some sort of catch all route? So whenever it's not an url which matches a route, it should just call getHomeR.
You can use multi-piece routes, and will likely need overlap checking turned off. This would look like:
For more information, see the routing chapter of the Yesod book.