add: Single Page routing

This commit is contained in:
Simon Hardt
2021-05-29 00:12:22 +02:00
parent cb63d33c56
commit a374a7c01a
4 changed files with 237 additions and 28 deletions

View File

@@ -0,0 +1,28 @@
module Route exposing (..)
import Url exposing (Url)
import Url.Parser exposing (..)
type Route
= NotFound
| Home
| Files
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")
]