Work
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
import { createExpressMiddleware } from "@trpc/server/adapters/express"
|
||||
import { Config, Effect, Layer } from "effect"
|
||||
import { Effect, Layer } from "effect"
|
||||
import { ExpressApp } from "../express/ExpressApp"
|
||||
import { TRPCContextCreator } from "../trpc/TRPCContextCreator"
|
||||
import { appRouter } from "./routers"
|
||||
import { RPCRouter } from "./RPCRouter"
|
||||
import { rpcRoot } from "./config"
|
||||
|
||||
|
||||
export module RPCServer {
|
||||
export const Live = Layer.effectDiscard(Effect.gen(function*() {
|
||||
const app = yield* ExpressApp
|
||||
|
||||
app.use(
|
||||
yield* Config.string("RPC_ROOT").pipe(Config.withDefault("/rpc")),
|
||||
|
||||
app.use(yield* rpcRoot,
|
||||
createExpressMiddleware({
|
||||
router: yield* appRouter,
|
||||
router: yield* RPCRouter,
|
||||
createContext: yield* TRPCContextCreator,
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user