Skip to content

Commit

Permalink
Fix greetings app according to the documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
damjad committed May 16, 2024
1 parent 1ff54f4 commit 0a03839
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ object GreetingRoutes:
if (req.url.queryParams.nonEmpty)
ZIO.succeed(
Response.text(
s"Hello ${req.url.queryParams("name").map(_.mkString(" and "))}!"
s"Hello ${req.url.queryParams("name").reduce((x, y) => x + " and " + y)}!"
)
)
else
ZIO.fail(Response.badRequest("The name query parameter is missing!"))
ZIO.succeed(Response.text(s"Hello World!"))
},

// GET /greet
Method.GET / "greet" -> handler(Response.text(s"Hello World!")),

// GET /greet/:name
Method.GET / "greet" / string("name") -> handler {
(name: String, _: Request) =>
Expand Down

0 comments on commit 0a03839

Please sign in to comment.