xesite/frontend/src/Routes.purs

32 lines
752 B
Plaintext
Raw Normal View History

2016-12-14 07:11:20 +00:00
module App.Routes where
2016-12-14 22:53:00 +00:00
import App.BlogEntry as BlogEntry
import App.BlogIndex as BlogIndex
import App.Counter as Counter
2016-12-14 07:11:20 +00:00
import Control.Alt ((<|>))
import Control.Apply ((<*), (*>))
import Data.Functor ((<$))
import Data.Maybe (fromMaybe)
import Prelude (($), (<$>))
import Pux.Router (param, router, lit, str, end)
data Route = Home
| Resume
2016-12-14 22:53:00 +00:00
| ContactPage
2016-12-14 07:11:20 +00:00
| StaticPage String
| BlogIndex
| BlogPost String
| NotFound
match :: String -> Route
match url = fromMaybe NotFound $ router url $
Home <$ end
<|>
BlogIndex <$ lit "blog" <* end
2016-12-14 19:54:17 +00:00
<|>
BlogPost <$> (lit "blog" *> str) <* end
2016-12-14 22:53:00 +00:00
<|>
ContactPage <$ lit "contact" <* end
2016-12-18 16:51:32 +00:00
<|>
Resume <$ lit "resume" <* end