aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/app/Main.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/backend/app/Main.hs b/backend/app/Main.hs
index df5dee8..59eab03 100644
--- a/backend/app/Main.hs
+++ b/backend/app/Main.hs
@@ -221,6 +221,11 @@ main = do
respond $
W.responseLBS W.status200 [] $
J.encode (last repo.commits).schemaVersion
+ Right ListCollections -> do
+ repo <- atomically (readTMVar repoT)
+ respond $
+ W.responseLBS W.status200 [] $
+ J.encode (map (.path) (last repo.commits).collections)
(traceShowId -> !_) ->
respond $ W.responseLBS W.status200 [] "not implemented"
@@ -228,13 +233,15 @@ data Route
= SchemaJson String
| Query
| SchemaVersion
+ | ListCollections
deriving (Show)
routeP :: P.Parser Route
routeP =
( P.choice
- [ SchemaJson <$> (P.string "/" *> P.manyTill P.anyChar (P.string ".schema.json")),
+ [ pure ListCollections <* P.string "/collections",
pure SchemaVersion <* P.string "/schemaVersion",
+ SchemaJson <$> (P.string "/" *> P.manyTill P.anyChar (P.string ".schema.json")),
pure Query <* P.string "/"
]
)