zio-akka-http-interop
zio-akka-http-interop copied to clipboard
Using ZIO in Directives?
Is it possible to use ZIO in akka directives?
def foo: Directive1[F] =
withToken.flatMap(
token =>
onComplete(
//some ZIO is returned here
)
)
In scenarios like this, what is the way to go forward. One way is to use runtime.unsafeRuntoFuture(someZIO)
. But isn't this an expensive thing to do (as this directives are called ever time the route is hit) ? Is there any other way to approaching this