Context transaction
This commit is contained in:
@@ -3,6 +3,7 @@ import { Effect, Layer } from "effect"
|
||||
import { rpcHTTPRoot } from "../config"
|
||||
import { ExpressApp } from "../http/ExpressApp"
|
||||
import { TRPCContextCreator } from "../trpc/TRPCContextCreator"
|
||||
import { contextCreatorExpressAdapter } from "../trpc/adapters"
|
||||
import { RPCRouter } from "./RPCRouter"
|
||||
|
||||
|
||||
@@ -13,7 +14,7 @@ export module RPCRoute {
|
||||
app.use(yield* rpcHTTPRoot,
|
||||
createExpressMiddleware({
|
||||
router: yield* RPCRouter,
|
||||
createContext: yield* TRPCContextCreator,
|
||||
createContext: contextCreatorExpressAdapter(yield* TRPCContextCreator),
|
||||
}),
|
||||
)
|
||||
}))
|
||||
|
||||
@@ -2,6 +2,7 @@ import { applyWSSHandler } from "@trpc/server/adapters/ws"
|
||||
import { Effect, Layer } from "effect"
|
||||
import { WebSocketServer } from "../http/WebSocketServer"
|
||||
import { TRPCContextCreator } from "../trpc/TRPCContextCreator"
|
||||
import { contextCreatorWSSAdapter } from "../trpc/adapters"
|
||||
import { RPCRouter } from "./RPCRouter"
|
||||
|
||||
|
||||
@@ -11,7 +12,7 @@ export module RPCWebSocketHandler {
|
||||
return applyWSSHandler({
|
||||
wss: yield* WebSocketServer,
|
||||
router: yield* RPCRouter,
|
||||
createContext: yield* TRPCContextCreator,
|
||||
createContext: contextCreatorWSSAdapter(yield* TRPCContextCreator),
|
||||
})
|
||||
}),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user