Even more docs, adds response utils to module
This commit is contained in:
12
types.ts
12
types.ts
@@ -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;
|
||||
|
Reference in New Issue
Block a user