about summary refs log tree commit diff
path: root/zoo/Main.hs
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-08-14T12·13+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-08-20T10·26+0100
commitb984a2d1e079e0463e0bc00af151612c0e5b0345 (patch)
tree31909d71ad2c31a02fb682a08ffc2ee95aaeffa3 /zoo/Main.hs
parentd903afeb5438e62d24cd4e3420140f913e259bf9 (diff)
Change GET /mimi to GET /hello
Timing myself to see how long it takes me to publish a change.
Diffstat (limited to 'zoo/Main.hs')
-rw-r--r--zoo/Main.hs12
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