add collections

This commit is contained in:
Alexander Foremny
2024-06-07 16:14:52 +02:00
parent 79dd6af899
commit 8a34cc822c
5 changed files with 74 additions and 46 deletions

21
backend/app/Route.hs Normal file
View File

@@ -0,0 +1,21 @@
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