aboutsummaryrefslogtreecommitdiffstats
path: root/backend/app/Route.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-06-07 16:14:52 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-06-07 17:06:17 +0200
commit8a34cc822c2c508472fe29ab2be1b74ba06e59e6 (patch)
tree74a67b93a76addabdb0fcf9e9479f4c6f7b4d113 /backend/app/Route.hs
parent79dd6af899fbaf7c413d7fd864f5716cbdf544e5 (diff)
add collections
Diffstat (limited to 'backend/app/Route.hs')
-rw-r--r--backend/app/Route.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/backend/app/Route.hs b/backend/app/Route.hs
new file mode 100644
index 0000000..61fa699
--- /dev/null
+++ b/backend/app/Route.hs
@@ -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