Creating a Custom Handler for a Specific Endpoint with `@effect/platform/HttpRouter`

With @effect/platform/HttpRouter, how do I create a custom handler for a specific endpoint?

The docs only every mention @effect/platform/HttpServerResponse as a way to handle specific endpoints, but I need to write custom logic within my handler.

// Example from documentation
import { HttpRouter, HttpServer, HttpServerResponse } from "@effect/platform"
import { NodeHttpServer, NodeRuntime } from "@effect/platform-node"
import { Layer } from "effect"
import { createServer } from "node:http"

// Define the router with a single route for the root URL
const router = HttpRouter.empty.pipe(
  HttpRouter.get("/", HttpServerResponse.text("Hello World"))
)
Was this page helpful?