Creating middleware that accesses both request-specific and program-level services can be challen...
How am I supposed to create a middleware that can access a request-specific service (like my error and metrics reporters) and/or access a program level service like my database? AFAICT, it's not possible to do this with HttpApiMiddleware.Tag
Similar discussion was here, but the solution discussed looks like a hack if I need to then remember to
Effect.provide(yield* effectFromMiddleware)
Effect.provide(yield* effectFromMiddleware)
in every route I need to access metrics/error reporter
Alternatively, how can I add a HttpApp middleware above an HttpApi that is being constructed for an HttpLayerRouter? This would ultimately be my best option, since I have most my middleware already defined in terms of HttpApp -> HttpApp, but I'm not exactly seeing where that goes (see screenshot in thread)