Start routing and pipeline rewrite
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -11,6 +11,7 @@ import {Controller} from '../Controller'
|
||||
import {Middlewares} from '../../service/Middlewares'
|
||||
import {Middleware} from './Middleware'
|
||||
import {Config} from '../../service/Config'
|
||||
import {Validator} from '../../validation/Validator'
|
||||
|
||||
/**
|
||||
* Type alias for an item that is a valid response object, or lack thereof.
|
||||
@@ -66,7 +67,7 @@ export class Route extends AppClass {
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and compile all of the registered routes and their groups, accounting
|
||||
* Load and compile all the registered routes and their groups, accounting
|
||||
* for nested groups and resolving handlers.
|
||||
*
|
||||
* This function attempts to resolve the route handlers ahead of time to cache
|
||||
@@ -215,6 +216,8 @@ export class Route extends AppClass {
|
||||
/** Pre-compiled route handler for the main route handler for this route. */
|
||||
protected compiledPostflight?: ResolvedRouteHandler[]
|
||||
|
||||
protected validator?: Validator<unknown>
|
||||
|
||||
/** Programmatic aliases of this route. */
|
||||
public aliases: string[] = []
|
||||
|
||||
@@ -387,6 +390,15 @@ export class Route extends AppClass {
|
||||
return this
|
||||
}
|
||||
|
||||
input(validator: Validator<any>): this {
|
||||
if ( !this.validator ) {
|
||||
//
|
||||
}
|
||||
|
||||
this.validator = validator
|
||||
return this
|
||||
}
|
||||
|
||||
/** Prefix the route's path with the given prefix, normalizing `/` characters. */
|
||||
private prepend(prefix: string): this {
|
||||
if ( !prefix.endsWith('/') ) {
|
||||
|
||||
Reference in New Issue
Block a user