// Define our API with one group named "Health"
const ServerApi = HttpApi.make("ServerApi").add(
HttpApiGroup.make("Health")
.add(HttpApiEndpoint.get("hello-world")`/`.addSuccess(Schema.String))
.add(
HttpApiEndpoint.get("health-check")`/health-check`.addSuccess(
Schema.String,
),
),
)
// Implement the "Health" group
const HealthLive = HttpApiBuilder.group(ServerApi, "Health", (handlers) => {
return handlers
.handle("hello-world", () => Effect.succeed("Hello, World!"))
.handle("health-check", () => Effect.succeed("Looks ok."))
})
// Provide the implementation for the API
export const ServerApiLive = HttpApiBuilder.api(ServerApi).pipe(
Layer.provide(HealthLive),
HttpServer.withLogAddress,
Layer.provide(BunHttpServer.layer({})),
)
// Define our API with one group named "Health"
const ServerApi = HttpApi.make("ServerApi").add(
HttpApiGroup.make("Health")
.add(HttpApiEndpoint.get("hello-world")`/`.addSuccess(Schema.String))
.add(
HttpApiEndpoint.get("health-check")`/health-check`.addSuccess(
Schema.String,
),
),
)
// Implement the "Health" group
const HealthLive = HttpApiBuilder.group(ServerApi, "Health", (handlers) => {
return handlers
.handle("hello-world", () => Effect.succeed("Hello, World!"))
.handle("health-check", () => Effect.succeed("Looks ok."))
})
// Provide the implementation for the API
export const ServerApiLive = HttpApiBuilder.api(ServerApi).pipe(
Layer.provide(HealthLive),
HttpServer.withLogAddress,
Layer.provide(BunHttpServer.layer({})),
)