MCPcopy Create free account
hub / github.com/effect-app/libs / handler

Function handler

repos/effect/packages/platform-bun/src/BunHttpServer.ts:138–150  ·  view source on GitHub ↗
(request: Request, server: BunServer<WebSocketContext>)

Source from the content-addressed store, hash-verified

136 const shutdown = yield* Effect.promise(() => server.stop()).pipe(
137 Effect.cached
138 )
139 const preemptiveShutdown = options.disablePreemptiveShutdown ? Effect.void : Effect.timeoutOrElse(shutdown, {
140 duration: options.gracefulShutdownTimeout ?? Duration.seconds(20),
141 orElse: () => Effect.void
142 })
143
144 yield* Scope.addFinalizer(scope, shutdown)
145
146 return Server.make({
147 address: { _tag: "TcpAddress", port: server.port!, hostname: server.hostname! },
148 serve: Effect.fnUntraced(function*(httpApp, middleware) {
149 const parent = yield* Effect.fiber
150 const services = parent.context
151 const serveScope = Context.getUnsafe(services, Scope.Scope)
152 const scope = Scope.forkUnsafe(serveScope, "parallel")
153

Callers 15

runRawMethod · 0.70
onMessageFunction · 0.70
makeCommandWithWrapFunction · 0.50
projectHandlerFunction · 0.50
theStreamHandlerMethod · 0.50
CommanderImplClass · 0.50
actFunction · 0.50
onMessageFunction · 0.50
onDataFunction · 0.50
HttpApi.test.tsFile · 0.50

Calls 4

addEventListenerMethod · 0.80
interruptUnsafeMethod · 0.80
removeHostFunction · 0.70
setMethod · 0.65

Tested by 5

makeHttpClientFunction · 0.40
makeHttpClientFunction · 0.40
makeHttpClientFunction · 0.40
makeHttpClientFunction · 0.40
makeHttpClientFunction · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…