diff --git a/README.md b/README.md index 1a56ab4f..464deeac 100644 --- a/README.md +++ b/README.md @@ -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.