summaryrefslogtreecommitdiff
path: root/fig-frontend/src/Fig/Frontend.hs
diff options
context:
space:
mode:
Diffstat (limited to 'fig-frontend/src/Fig/Frontend.hs')
-rw-r--r--fig-frontend/src/Fig/Frontend.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/fig-frontend/src/Fig/Frontend.hs b/fig-frontend/src/Fig/Frontend.hs
index 95ab28b..3cab953 100644
--- a/fig-frontend/src/Fig/Frontend.hs
+++ b/fig-frontend/src/Fig/Frontend.hs
@@ -60,4 +60,9 @@ app cfg = do
DB.hvals db "songnames" >>= \case
Nothing -> Tw.send . Tw.status Tw.status404 $ Tw.text "no sounds found :("
Just songs -> Tw.send . Tw.text . pretty . SExprList @Void $ SExprString . decodeUtf8 <$> songs
+ , Tw.get "/api/song/:hash" do
+ hash <- Tw.param "hash"
+ DB.hget db "songnotes" hash >>= \case
+ Nothing -> Tw.send . Tw.status Tw.status404 $ Tw.text "song not found"
+ Just val -> Tw.send . Tw.text $ decodeUtf8 val
]