diff options
Diffstat (limited to 'zoo/Main.hs')
-rw-r--r-- | zoo/Main.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/zoo/Main.hs b/zoo/Main.hs index 8706a7daac7e..407d29e61e3a 100644 --- a/zoo/Main.hs +++ b/zoo/Main.hs @@ -18,11 +18,12 @@ import qualified Network.Wai.Handler.Warp as Warp type Api = "run" :> QueryParam' '[Required] "offset" Text :> Get '[JSON] UTCTime - :<|> "mimi" + :<|> "hello" + :> QueryParam "name" Text :> Get '[JSON] Text server :: Server Api -server = compute :<|> helloMimi +server = compute :<|> hello where compute :: Text -> Handler UTCTime compute x = do @@ -31,8 +32,11 @@ server = compute :<|> helloMimi Just req -> do res <- liftIO $ shiftTime req pure res - helloMimi :: Handler Text - helloMimi = pure "Hello, Mimi" + hello :: Maybe Text -> Handler Text + hello mName = + case mName of + Nothing -> pure "Hello, world!" + Just name -> pure $ RIO.Text.concat ["Hello, ", name] data ShiftTimeRequest = ShiftTimeRequest { shiftSeconds :: Int |