zio-akka-http-interop icon indicating copy to clipboard operation
zio-akka-http-interop copied to clipboard

Using ZIO in Directives?

Open ashwinbhaskar opened this issue 3 years ago • 0 comments

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

ashwinbhaskar avatar Aug 09 '21 11:08 ashwinbhaskar