Files
acms/backend/app/Route.hs

22 lines
495 B
Haskell
Raw Normal View History

2024-06-07 16:14:52 +02:00
module Route (Route (..), parser) where
import Data.Attoparsec.Char8 qualified as P
data Route
= SchemaJson String
| Query
| SchemaVersion
| Collections
deriving (Show)
parser :: P.Parser Route
parser =
( P.choice
[ pure Collections <* P.string "/collections",
pure SchemaVersion <* P.string "/schemaVersion",
SchemaJson <$> (P.string "/" *> P.manyTill P.anyChar (P.string ".schema.json")),
pure Query <* P.string "/"
]
)
<* P.endOfInput