Config refactoring
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Effect, Layer } from "effect"
|
||||
import { expressHandler } from "trpc-playground/handlers/express"
|
||||
import { rpcHTTPPlaygroundRoot, rpcHTTPRoot } from "../config"
|
||||
import { ServerConfig } from "../ServerConfig"
|
||||
import { ExpressApp } from "../http/ExpressApp"
|
||||
import { RPCRouter } from "./RPCRouter"
|
||||
|
||||
@@ -10,10 +10,10 @@ export module RPCPlaygroundRoute {
|
||||
|
||||
export const Dev = Layer.effectDiscard(Effect.gen(function*() {
|
||||
const app = yield* ExpressApp
|
||||
const playgroundEndpoint = yield* rpcHTTPPlaygroundRoot
|
||||
const playgroundEndpoint = yield* ServerConfig.rpcHTTPPlaygroundRoot
|
||||
|
||||
const handler = expressHandler({
|
||||
trpcApiEndpoint: yield* rpcHTTPRoot,
|
||||
trpcApiEndpoint: yield* ServerConfig.rpcHTTPRoot,
|
||||
playgroundEndpoint,
|
||||
router: yield* RPCRouter,
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createExpressMiddleware } from "@trpc/server/adapters/express"
|
||||
import { Effect, Layer } from "effect"
|
||||
import { rpcHTTPRoot } from "../config"
|
||||
import { ServerConfig } from "../ServerConfig"
|
||||
import { ExpressApp } from "../http/ExpressApp"
|
||||
import { TRPCContextCreator } from "../trpc/TRPCContextCreator"
|
||||
import { RPCRouter } from "./RPCRouter"
|
||||
@@ -10,7 +10,7 @@ export module RPCRoute {
|
||||
export const Live = Layer.effectDiscard(Effect.gen(function*() {
|
||||
const app = yield* ExpressApp
|
||||
|
||||
app.use(yield* rpcHTTPRoot,
|
||||
app.use(yield* ServerConfig.rpcHTTPRoot,
|
||||
createExpressMiddleware({
|
||||
router: yield* RPCRouter,
|
||||
createContext: (yield* TRPCContextCreator).createExpressContext,
|
||||
|
||||
Reference in New Issue
Block a user