const AllRoutes = HttpRouter.Default.use((router) =>
Effect.gen(function*() {
yield* router.mount("/users", yield* UserRouter.router)
})
).pipe(Layer.provide(AllUserRoutes))
const ServerLive = BunHttpServer.layer({ port: 3000 })
// use the `.unwrap` api to turn the underlying `HttpRouter` into another layer.
// Here we use `HttpServer.serve` to create a server from the `HttpRouter`.
const HttpLive = HttpRouter.Default.unwrap(HttpServer.serve(HttpMiddleware.logger)).pipe(
HttpServer.withLogAddress,
Layer.provide(AllRoutes),
Layer.provide(ServerLive)
)
const AllRoutes = HttpRouter.Default.use((router) =>
Effect.gen(function*() {
yield* router.mount("/users", yield* UserRouter.router)
})
).pipe(Layer.provide(AllUserRoutes))
const ServerLive = BunHttpServer.layer({ port: 3000 })
// use the `.unwrap` api to turn the underlying `HttpRouter` into another layer.
// Here we use `HttpServer.serve` to create a server from the `HttpRouter`.
const HttpLive = HttpRouter.Default.unwrap(HttpServer.serve(HttpMiddleware.logger)).pipe(
HttpServer.withLogAddress,
Layer.provide(AllRoutes),
Layer.provide(ServerLive)
)