From b984a2d1e079e0463e0bc00af151612c0e5b0345 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Fri, 14 Aug 2020 13:13:23 +0100 Subject: Change GET /mimi to GET /hello Timing myself to see how long it takes me to publish a change. --- zoo/Main.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'zoo') 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 -- cgit 1.4.1