A higher-level HTTP app/router layer built on top of HttpServer.
Use App.get, App.post, middleware, groups, and mounts to build simple request routing without dropping to the low-level request-handler callback for every endpoint.
@eryx/http/App ModuleA higher-level HTTP app/router layer built on top of HttpServer.
Use App.get, App.post, middleware, groups, and mounts to build simple request routing without dropping to the low-level request-handler callback for every endpoint.
Registers a route handler for a method/path pair.
HTTP method such as "GET" or "POST".
Route pattern beginning with /. Supports :param and trailing *splat.
Request handler for matching requests.
Optional route metadata such as a route name or route-local middleware.
Self, for chaining.
Registers middleware that wraps every route and mounted child app.
Middleware callback receiving (ctx, next).
App
Registers server-side session middleware and exposes ctx.session.
Session middleware options.
App
Registers a handler for framework-generated status responses such as 404 or 405.
HTTP status code to intercept.
Handler that returns the replacement response.
App
Registers a catch-all exception handler for uncaught route or middleware errors.
Recovery handler receiving (ctx, err).
App
Mounts another app or router under a URL prefix.
Parent middleware runs before child middleware, and child routes see
ctx.mountPath / ctx.pathWithinMount.
App
Creates and mounts a child router under a prefix, then optionally configures it.
URL prefix such as "/api".
Optional callback invoked with the new child router.
The new child router.
Builds a URL for a named route.
Route name registered through options.name.
The generated relative URL.
Mounts a static directory under a URL prefix.
Files are served for GET/HEAD requests only. Requests that attempt
path traversal are rejected. When fallthrough is true, missing files
continue to later routes instead of immediately returning 404.
URL prefix such as "/assets".
Filesystem directory to expose.
Static file options.
App
Registers a GET route.
Route pattern beginning with /.
Handler for matching requests.
Optional route metadata.
App
Registers a POST route.
Route pattern beginning with /.
Handler for matching requests.
Optional route metadata.
App
Registers a PUT route.
Route pattern beginning with /.
Handler for matching requests.
Optional route metadata.
App
Registers a DELETE route.
Route pattern beginning with /.
Handler for matching requests.
Optional route metadata.
App
Registers a PATCH route.
Route pattern beginning with /.
Handler for matching requests.
Optional route metadata.
App
Registers a HEAD route.
Route pattern beginning with /.
Handler for matching requests.
Optional route metadata.
App
Registers an OPTIONS route.
Route pattern beginning with /.
Handler for matching requests.
Optional route metadata.
App
Registers a route that matches any method.
Route pattern beginning with /.
Handler for matching requests.
Optional route metadata.
App
Registers a WebSocket endpoint.
Route pattern beginning with /.
Handler receiving (ctx, ws) after a successful upgrade.
Optional route metadata.
App
Returns a low-level HttpServer-compatible handler for this app.
(HttpServer.ServerRequest, ServerResponse.ServerResponse) -> ()
Creates a low-level HttpServer that dispatches through this app.
Optional server options overriding app defaults.
HttpServer
Starts listening with this app's handler.
This is a convenience wrapper around App.createServer followed by HttpServer.listen.
Optional listener-ready callback receiving (host, port).
Optional server options overriding app defaults.
Closes the underlying server if this app is currently listening.
Returns the first parsed request cookie value for the given cookie name.
Cookie name.
string?
Appends a Set-Cookie response header.
Clears a cookie by setting it to an empty value with an expired timestamp.
Cookie name.
Cookie attributes such as path or domain to target the existing cookie.
Streams a file as the HTTP response body.
Filesystem path to the file.
Optional response overrides.
Optional metadata for route registration helpers like App.get.
Route-local middleware that runs inside app/group middleware but before the handler.
WebSocket upgrade options, used by App.websocket.
Options for AppContext.sendFile.
Options for setting response cookies from the app layer.
Appends a Set-Cookie response header.
Clears a cookie with an expired Set-Cookie response header.
Streams a file as the response body.