aboutsummaryrefslogtreecommitdiffstats
path: root/backend/app/Route.hs
diff options
context:
space:
mode:
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