Skip to content

Commit

Permalink
Change to code snippet compatible with ZIO 2 (zio#1398)
Browse files Browse the repository at this point in the history
  • Loading branch information
SHSongs authored Aug 26, 2022
1 parent 55dc691 commit c75b473
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,18 @@ Check out the full documentation here: [Documentation]
A simple Http server can be built using a few lines of code.

```scala
import zio._
import zhttp.http._
import zhttp.service.Server
import zio._

object HelloWorld extends ZIOAppDefault {

object HelloWorld extends App {
val app = Http.collect[Request] {
val app: HttpApp[Any, Nothing] = Http.collect[Request] {
case Method.GET -> !! / "text" => Response.text("Hello World!")
}

override def run(args: List[String]): URIO[zio.ZEnv, ExitCode] =
Server.start(8090, app).exitCode
override val run =
Server.start(8090, app)
}
```
#### Examples
Expand Down

0 comments on commit c75b473

Please sign in to comment.