TypeDoc all the thngs
This commit is contained in:
@@ -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')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user