Skip to main content
Effect can turn any (request: Request) => Promise<Response> function into a route, which is what createTheAuthHandler from @glinr/theauth/http returns. So there is no Effect package: you use the core handler directly. The HTTP modules moved between major versions. Effect 4 ships them inside effect (effect/http), Effect 3 ships them in @effect/platform. The wiring is the same, only the import paths and the router API differ.

Install

Effect 4

server.ts
Do not register "/api/theauth" as a second route. The router rejects it as a duplicate of the wildcard. Inside a handler, build the Web Request with HttpServerRequest.toWeb. Passing request.url to new Request(...) fails, because the server request holds only the path.

Effect 3

server.ts

Serverless and tests

HttpRouter.toWebHandler(routes) turns the same routes back into a (request) => Promise<Response>, which is handy for tests and for runtimes that want a fetch handler. You then do not need NodeHttpServer.

What was run

Both snippets type check under strict and were started with tsx, against effect 4.0.5 with @effect/platform-node 4.0.5, and effect 3.22.3 with @effect/platform 0.97.2. @glinr/theauth was installed from a packed tarball. On both versions: GET /api/theauth/agents without a session answered 401, an unknown path under the mount answered 404, GET /docs without a token answered 401, and with a real agent token GET /docs answered 200 and POST /api/theauth/authorize/token with a JSON body answered 200 for a granted action.
Last modified on October 19, 2026