Setup Phoenix Router with a Single Page App
I’ve been playing around with Phoenix for a personal project. Phoenix by default comes
setup with a basic PageController
. I wanted to use Elm’s Navigation package to handle routing
on my Elm app.
With the default setup, Phoenix will attempt to serve the route, ending in a 404. I had to change my router.ex
to the following to allow any path to defer to the PageController.index
function:
This should work for any router in JavaScript, Elm, or < insert language here > 😄.
No comments yet. Share on Mastodon and see your comment or write a post on your blog if you support Webmentions
No reposts yet. Share on Mastodon and see your repost or write a post on your blog if you support Webmentions
No likes yet. Share on Mastodon and see your like or write a post on your blog if you support Webmentions
No bookmarks yet. Share on Mastodon and see your bookmark or write a post on your blog if you support Webmentions
Powered by Webmentions