zio-http
zio-http copied to clipboard
Better Example With Layers
What is not easy to do right now?
It is not clear how to get started using zhttp with a dependency for your HttpApp or something for your R
Describe the solution you'd like
A simple example of HttpApp where there is an R
that does the "logic" doesn't have to be anything complex.
Why is it important? This is a great project, but to newcomers the idea of returning raw string text or json is not appealing. This will give a clear and straightforward example of how to pick up and put zhttp on top of an existing service.
Additional context
For an existing project in other frameworks I know how to write a service with functions A => B
but in the examples here all I see are examples of Path => String
and this is quick and easy. However, if I have a dependency like ServiceA
there are no examples with R
on any documentation.
The documentation is really here. I can't find anywhere how to provide layers to my app. With io.d11 was as simple as Server .start(8080, endpoints) .provide( Layer1.live, Layer2.live)
The documentation is really here. I can't find anywhere how to provide layers to my app.
With io.d11 was as simple as
Server
.start(8080, endpoints) .provide( Layer1.live, Layer2.live)
Does this work?
https://github.com/8bitreid/zio-examples/blob/main/src/main/scala/example/zhttp/ZhttpServer.scala
Yeah, that helps, thanks