/hop

Navigation and routing helpers for single page applications in Elm

Primary LanguageElm

Hop: Navigation and routing matchers for Elm SPAs

Build Status

alt Hop

Hop is meant to be used with the Elm Navigation package.

On top of Elm Navigation Hop provides:

  • Matchers for URL parsing
  • Support for nested routes
  • A helper for reverse routing
  • Transparent support for push or hash routing
  • Helpers for changing the query string
  • Encode / Decode query string

Getting Started

Please see this example app. It explains how to wire everything in the comments.

Docs

More docs

Hash routing

A proper url should have the query before the hash e.g. ?keyword=Ja#/users/1, but when using hash routing, query parameters are appended after the hash path e.g. #/users/1?keyword=Ja. This is done for aesthetics and so the router is fully controlled by the hash fragment.

Examples

See examples/basic and examples/full folders. To run the example apps:

  • Clone this repo
  • Go to example folder
  • Follow the readme in that folder

Acknowledgements

Thanks to @etaque and @Bogdanp for the inspiration to make this better.