TypeDoc all the thngs

This commit is contained in:
2021-03-25 08:50:13 -05:00
parent 7cb0546b01
commit fad1184afe
52 changed files with 976 additions and 3 deletions

View File

@@ -6,6 +6,9 @@ import {Route} from "../http/routing/Route";
import {HTTPMethod} from "../http/lifecycle/Request";
import {ViewEngineFactory} from "../views/ViewEngineFactory";
/**
* Application unit that loads the various route files from `app/http/routes` and pre-compiles the route handlers.
*/
@Singleton()
export class Routing extends Unit {
@Inject()
@@ -35,12 +38,21 @@ export class Routing extends Unit {
})
}
/**
* Given an HTTPMethod and route path, return the Route instance that matches them,
* if one exists.
* @param method
* @param path
*/
public match(method: HTTPMethod, path: string): Route | undefined {
return this.compiledRoutes.firstWhere(route => {
return route.match(method, path)
})
}
/**
* Get the universal path to the root directory of the route definitions.
*/
public get path(): UniversalPath {
return this.app().appPath('http', 'routes')
}