diff options
| author | LLLL Colonq <llll@colonq> | 2025-05-26 04:43:38 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2025-05-26 04:45:07 -0400 |
| commit | 1f2e453d0c9f8412b9032cb4e655713ecdcf1fa3 (patch) | |
| tree | c2e19550aeec4c092dceefb37a85497a4b90b485 /fig-web/src/Fig/Web/Module/Bells.hs | |
| parent | b5003a97d3f02b7c8cb5e63468b781d8d849264d (diff) | |
web: Refactor major style
Diffstat (limited to 'fig-web/src/Fig/Web/Module/Bells.hs')
| -rw-r--r-- | fig-web/src/Fig/Web/Module/Bells.hs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/fig-web/src/Fig/Web/Module/Bells.hs b/fig-web/src/Fig/Web/Module/Bells.hs new file mode 100644 index 0000000..7451079 --- /dev/null +++ b/fig-web/src/Fig/Web/Module/Bells.hs @@ -0,0 +1,26 @@ +module Fig.Web.Module.Bells + ( public + ) where + +import Fig.Prelude + +import Fig.Utils.SExpr +import Fig.Web.Utils +import Fig.Web.Types +import qualified Fig.Web.DB as DB + +public :: Module +public a = do + onGet "/api/songs" do + DB.hvals a.db "songnames" >>= \case + Nothing -> do + status status404 + respondText "no sounds found :(" + Just songs -> respondText . pretty . SExprList @Void $ SExprString . decodeUtf8 <$> songs + onGet "/api/song/:hash" do + hash <- pathParam "hash" + DB.hget a.db "songnotes" hash >>= \case + Nothing -> do + status status404 + respondText "song not found" + Just val -> respondText $ decodeUtf8 val |
