Skip to content
This repository has been archived by the owner on Mar 9, 2018. It is now read-only.

Latest commit

 

History

History
26 lines (19 loc) · 465 Bytes

reverse-routing.md

File metadata and controls

26 lines (19 loc) · 465 Bytes

Reverse routing

Reverse routing means converting a route tag back to an url e.g.

UserRoute 1 --> "/users/1"

In the current version Hop doesn't have any helpers for reverse routing. You can do this manually:

reverse : Route -> String
reverse route =
    case route of
        HomeRoute ->
            ""

        AboutRoute ->
            "about"

        UserRoute id ->
            "users/" ++ id 

        NotFoundRoute ->
            ""