Make new routing system the default
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:
@@ -2,7 +2,6 @@ import {Directive, OptionDefinition} from '../Directive'
|
||||
import {Inject, Injectable} from '../../di'
|
||||
import {Routing} from '../../service/Routing'
|
||||
import Table = require('cli-table')
|
||||
import {RouteHandler} from '../../http/routing/Route'
|
||||
|
||||
@Injectable()
|
||||
export class RouteDirective extends Directive {
|
||||
@@ -33,7 +32,7 @@ export class RouteDirective extends Directive {
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
|
||||
this.routing.getCompiled()
|
||||
/* this.routing.getCompiled()
|
||||
.filter(match => match.getRoute().trim() === route && (!method || match.getMethod() === method))
|
||||
.tap(matches => {
|
||||
if ( !matches.length ) {
|
||||
@@ -42,8 +41,7 @@ export class RouteDirective extends Directive {
|
||||
}
|
||||
})
|
||||
.each(match => {
|
||||
const pre = match.getMiddlewares()
|
||||
.where('stage', '=', 'pre')
|
||||
const pre = match.getPreflight()
|
||||
.map<[string, string]>(ware => [ware.stage, this.handlerToString(ware.handler)])
|
||||
|
||||
const post = match.getMiddlewares()
|
||||
@@ -62,10 +60,6 @@ export class RouteDirective extends Directive {
|
||||
table.push(...post.toArray())
|
||||
|
||||
this.info(`\nRoute: ${match}\n\n${table}`)
|
||||
})
|
||||
}
|
||||
|
||||
protected handlerToString(handler: RouteHandler): string {
|
||||
return typeof handler === 'string' ? handler : '(anonymous function)'
|
||||
})*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export class RoutesDirective extends Directive {
|
||||
}
|
||||
|
||||
async handle(): Promise<void> {
|
||||
const maxRouteLength = this.routing.getCompiled().max(route => String(route).length)
|
||||
/* const maxRouteLength = this.routing.getCompiled().max(route => String(route).length)
|
||||
const maxHandlerLength = this.routing.getCompiled().max(route => route.getDisplayableHandler().length)
|
||||
const rows = this.routing.getCompiled().map<[string, string]>(route => [String(route), route.getDisplayableHandler()])
|
||||
|
||||
@@ -28,6 +28,6 @@ export class RoutesDirective extends Directive {
|
||||
|
||||
table.push(...rows.toArray())
|
||||
|
||||
this.info('\n' + table)
|
||||
this.info('\n' + table)*/
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user