TypeDoc all the thngs
This commit is contained in:
@@ -1,14 +1,47 @@
|
||||
import {ErrorWithContext} from "@extollo/util";
|
||||
import {ResolvedRouteHandler, Route} from "./Route";
|
||||
|
||||
/**
|
||||
* Class representing a resolved route that a request is mounted to.
|
||||
*/
|
||||
export class ActivatedRoute {
|
||||
/**
|
||||
* The parsed params from the route definition.
|
||||
*
|
||||
* @example
|
||||
* If the route definition is like `/something/something/:paramName1/:paramName2/etc`
|
||||
* and the request came in on `/something/something/foo/bar/etc`, then the params
|
||||
* would be:
|
||||
*
|
||||
* ```typescript
|
||||
* {
|
||||
* paramName1: 'foo',
|
||||
* paramName2: 'bar',
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public readonly params: {[key: string]: string}
|
||||
|
||||
/**
|
||||
* The resolved function that should handle the request for this route.
|
||||
*/
|
||||
public readonly handler: ResolvedRouteHandler
|
||||
|
||||
/**
|
||||
* Pre-middleware that should be applied to the request on this route.
|
||||
*/
|
||||
public readonly preflight: ResolvedRouteHandler[]
|
||||
|
||||
/**
|
||||
* Post-middleware that should be applied to the request on this route.
|
||||
*/
|
||||
public readonly postflight: ResolvedRouteHandler[]
|
||||
|
||||
constructor(
|
||||
/** The route this ActivatedRoute refers to. */
|
||||
public readonly route: Route,
|
||||
|
||||
/** The request path that activated that route. */
|
||||
public readonly path: string
|
||||
) {
|
||||
const params = route.extract(path)
|
||||
|
||||
Reference in New Issue
Block a user