MCPcopy Create free account
hub / github.com/Effect-TS/effect / makeHandler

Function makeHandler

packages/effect/test/unstable/http/HttpCompression.test.ts:58–74  ·  view source on GitHub ↗
(
  app: App,
  options?: CompressionOptions,
  context?: Context.Context<HttpPlatform.HttpPlatform>
)

Source from the content-addressed store, hash-verified

56 })
57
58const makeHandler = (
59 app: App,
60 options?: CompressionOptions,
61 context?: Context.Context<HttpPlatform.HttpPlatform>
62) => {
63 const self = app as Effect.Effect<HttpServerResponse.HttpServerResponse, any, HttpServerRequest | Scope.Scope>
64 const middleware = HttpMiddleware.compression(options)
65 if (context !== undefined) {
66 return HttpEffect.toWebHandlerWith<HttpPlatform.HttpPlatform, HttpServerRequest | Scope.Scope>(context)(
67 self,
68 middleware
69 )
70 }
71 const { dispose, handler } = HttpEffect.toWebHandlerLayer(self, HttpServer.layerServices, { middleware })
72 disposers.push(dispose)
73 return handler
74}
75
76const disposers: Array<() => Promise<void>> = []
77

Callers 1

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected