跳到主要内容
版本:Next

MidwayWebRouterService

Hierarchy

Index

Constructors

constructor

Properties

readonlyoptions

Methods

publicaddController

  • addController(controllerClz: any, controllerOption: ControllerOption, functionMeta?: boolean): any
  • addController(controllerClz: any, controllerOption: ControllerOption, resourceOptions?: { resourceFilter: (routerInfo: RouterInfo) => boolean }, functionMeta?: boolean): any
  • dynamically add a controller

publicaddRouter

  • addRouter(routerFunction: (...args: any[]) => void, routerInfoOption: DynamicRouterInfo): void
  • dynamically add a route to root prefix

publicgetFlattenRouterTable

  • getFlattenRouterTable(options?: { compileUrlPattern?: boolean }): Promise<RouterInfo[]>

publicgetMatchedRouterInfo

  • getMatchedRouterInfo(routerUrl: string, method: string): Promise<RouterInfo>

publicgetRoutePriorityList

publicgetRouterTable

  • getRouterTable(): Promise<Map<string, RouterInfo[]>>

publicsortRouter

  • sortRouter(urlMatchList: RouterInfo[]): { _category: number; _level: number; _paramString: string; _pureRouter: string; _weight: number; controllerClz?: new (...args: any[]) => any; controllerId?: string; controllerMiddleware?: any[]; description?: string; fullUrl?: string; fullUrlCompiledRegexp?: RegExp; fullUrlFlattenString?: string; funcHandlerName?: string; functionMetadata?: any; functionName?: string; functionTriggerMetadata?: any; functionTriggerName?: string; handlerName?: string; id?: string; method: string | (...args: any[]) => void; middleware?: any[]; prefix?: string; requestMetadata?: any[]; requestMethod: string; responseMetadata?: any[]; routerName?: string; summary?: string; url: string | RegExp }[]