Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Hello World example #1526

Merged
merged 1 commit into from
Oct 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ Hello World!
This "Hello World!" example is built with just `finch-core`:

```scala
import io.finch._, cats.effect.IO
import com.twitter.finagle.Http
import com.twitter.util.Await

object Main extends App with Endpoint.Module[IO] {
val api: Endpoint[IO, String] = get("hello") { Ok("Hello, World!") }
Await.ready(Http.server.serve(":8080", api.toServiceAs[Text.Plain]))
import cats.effect.{IO, IOApp}
import io.finch._

object Main extends IOApp.Simple with Endpoint.Module[IO] {
override def run: IO[Unit] = {
val api: Endpoint[IO, String] = get("hello") { Ok("Hello, World!") }
Bootstrap[IO].serve[Text.Plain](api).listen(":8080").useForever
}
}
```

Expand Down