style
This commit is contained in:
parent
871aac104a
commit
803687b219
10
src/route.ts
10
src/route.ts
@ -63,6 +63,9 @@ export type RouteOpts = {
|
|||||||
isVerify?: boolean;
|
isVerify?: boolean;
|
||||||
verify?: (ctx?: RouteContext, dev?: boolean) => boolean;
|
verify?: (ctx?: RouteContext, dev?: boolean) => boolean;
|
||||||
verifyKey?: (key: string, ctx?: RouteContext, dev?: boolean) => boolean;
|
verifyKey?: (key: string, ctx?: RouteContext, dev?: boolean) => boolean;
|
||||||
|
/**
|
||||||
|
* $#$ will be used to split path and key
|
||||||
|
*/
|
||||||
idUsePath?: boolean;
|
idUsePath?: boolean;
|
||||||
isDebug?: boolean;
|
isDebug?: boolean;
|
||||||
};
|
};
|
||||||
@ -282,8 +285,8 @@ export class QueryRouter {
|
|||||||
* remove route by path and key
|
* remove route by path and key
|
||||||
* @param route
|
* @param route
|
||||||
*/
|
*/
|
||||||
remove(route: Route | { path: string; key: string }) {
|
remove(route: Route | { path: string; key?: string }) {
|
||||||
this.routes = this.routes.filter((r) => r.path === route.path && r.key === route.key);
|
this.routes = this.routes.filter((r) => r.path === route.path && r.key == route.key);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* remove route by id
|
* remove route by id
|
||||||
@ -548,6 +551,9 @@ export class QueryRouter {
|
|||||||
throw(...args: any[]) {
|
throw(...args: any[]) {
|
||||||
throw new CustomError(...args);
|
throw new CustomError(...args);
|
||||||
}
|
}
|
||||||
|
hasRoute(path: string, key?: string) {
|
||||||
|
return this.routes.find((r) => r.path === path && r.key === key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type QueryRouterServerOpts = {
|
type QueryRouterServerOpts = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user