@@ -24,10 +24,10 @@ import cats.effect.std.Dispatcher
24
24
import cats .effect .unsafe .implicits .global
25
25
import cats .effect .{IO , IOApp , Resource }
26
26
import cats .~>
27
- import natchez .akka .http .NatchezAkkaHttp
27
+ import natchez .akka .http .AkkaRoute
28
28
import natchez .akka .http .entrypoint .toEntryPointOps
29
29
import natchez .log .Log
30
- import natchez .{EntryPoint , Span , Trace }
30
+ import natchez .{EntryPoint , Span }
31
31
import org .typelevel .log4cats .Logger
32
32
import org .typelevel .log4cats .slf4j .Slf4jLogger
33
33
import sttp .tapir .integ .cats .syntax .*
@@ -61,14 +61,10 @@ object Main extends IOApp.Simple {
61
61
62
62
// lift the Route in a Kleisli to pass the span around implicitly
63
63
// use the Trace constraint on the services
64
- val liftedRoutes : Kleisli [IO , Span [IO ], Route ] = Kleisli { span =>
65
- Trace .ioTrace(span).flatMap { implicit t =>
66
- IO .executionContext.flatMap { implicit ec =>
67
- val helloService = new HelloService [IO ]
68
- val helloRoute : Route =
69
- AkkaHttpServerInterpreter ().toRoute(helloService.helloEndpoint.imapK(toFuture)(fromFuture))
70
- NatchezAkkaHttp .server(IO .delay(helloRoute))
71
- }
64
+ val liftedRoutes : Kleisli [IO , Span [IO ], Route ] = AkkaRoute .liftedRouteIO { implicit t =>
65
+ IO .executionContext.map { implicit ec =>
66
+ val helloService = new HelloService [IO ]
67
+ AkkaHttpServerInterpreter ().toRoute(helloService.helloEndpoint.imapK(toFuture)(fromFuture))
72
68
}
73
69
}
74
70
0 commit comments