Even more docs, adds response utils to module

This commit is contained in:
2025-01-04 19:26:09 -07:00
parent 5dad5bc0b1
commit fa73b0bdc0
4 changed files with 48 additions and 6 deletions

View File

@@ -3,6 +3,9 @@
* BearMetal Router types
*/
/**
* @description a context object for a request
*/
export interface RouterContext {
url: URL;
params: Record<string, string | undefined>;
@@ -27,17 +30,26 @@ export type Middleware = (
next: () => Promise<Response>,
) => Promise<Response>;
/**
* @description a route configuration
*/
export interface RouteConfig {
pattern: URLPattern;
handlers: { [method: string]: Handler };
}
/**
* @description a middleware configuration
*/
export interface MiddlewareConfig {
pattern: URLPattern;
handler: Middleware;
path: string;
}
/**
* @description a route configurator
*/
export interface RouteConfigurator {
get(handler: Handler): RouteConfigurator;
post(handler: Handler): RouteConfigurator;