Files
localTube/Modules/Website/src/Route.elm
2021-05-31 23:38:55 +02:00

31 lines
482 B
Elm

module Route exposing (..)
import Url exposing (Url)
import Url.Parser exposing (..)
type Route
= NotFound
| Home
| Files
| Status String
parseUrl : Url -> Route
parseUrl url =
case parse matchRoute url of
Just route ->
route
Nothing ->
NotFound
matchRoute : Parser (Route -> a) a
matchRoute =
oneOf
[ map Home top
, map Files (s "files")
, map Status (s "status" </> string)
]