list collections
This commit is contained in:
@@ -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 "/"
|
||||
]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user