Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
cornerman committed Jun 13, 2024
1 parent 60fe768 commit 41f7b23
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,36 @@ new Api {
}
```

## Integrations

### http4s

Use with:
```
libraryDependencies += "com.github.cornerman" %%% "sloth-http4s-server" % "0.7.1"
libraryDependencies += "com.github.cornerman" %%% "sloth-http4s-client" % "0.7.1"
```

On the server:
```scala
import sloth.Router
import sloth.ext.http4s.server.HttpRpcRoutes

val router = Router[String, IO]
val rpcRoutes: HttpRoutes[IO] = HttpRpcRoutes[String, IO](router)
// see HttpRpcRoutes.eventStream[IO] for streaming server sent events
```

In the client:
```scala
import sloth.Client
import sloth.ext.http4s.client.HttpRpcTransport

val client = Client[String, fs2.Stream[IO, *]](HttpRpcTransport.eventStream[IO])
val api: MyApi[fs2.Stream[IO, *]] = client.wire[MyApi[fs2.Stream[IO, *]]]
// see HttpRpcTransport.eventStream[IO] for streaming server sent events
```

## Experimental: Checksum for Apis

Currently scala-2 only.
Expand Down

0 comments on commit 41f7b23

Please sign in to comment.