Edit: Here are some small working hash-based routing examples:
I’m trying to restore the “Save Gist” button to TryPurescript, and I believe incorporating routing is a prerequisite for that. The github OAuth guide recommends redirecting back to a
But I’m having a lot of trouble figuring out what to piece together from the routing guide in order to introduce routing to an app. It’s also unclear why one would choose
Routing.PushState. A small cookbook example demonstrating routing would be really helpful.
Here’s an attempt where I observe the following:
- Route parsing appears to be working. If I uncomment
main = logRouteTests, then I see this expected output:
(Right (PostEdit 8)) (Right (Post 8)) (Right (PostBrowse "foo" "bar")) (Right PostIndex)
- But when I uncomment
main = logRouteand navigate to the following pages, only
(Right PostIndex)is logged:
Steps to reproduce:
git clone --branch routing firstname.lastname@example.org:milesfrain/halogen.git routing-help cd routing-help npm run build npm run serve
I assume that routing code can’t be shared and troubleshooted via TryPurescript.