@hestjs/core
Version:
HestJS Core Framework - A TypeScript framework built on Hono with dependency injection and decorators
47 lines • 948 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RouteMetadata = void 0;
/**
* 路由元数据收集器
*/
class RouteMetadata {
routes = [];
/**
* 添加路由
*/
add(route) {
this.routes.push(route);
}
/**
* 获取所有路由
*/
getAll() {
return [...this.routes];
}
/**
* 根据控制器获取路由
*/
getByController(controller) {
return this.routes.filter(route => route.controller === controller);
}
/**
* 根据方法获取路由
*/
getByMethod(method) {
return this.routes.filter(route => route.method === method);
}
/**
* 清空路由
*/
clear() {
this.routes = [];
}
/**
* 路由数量
*/
get size() {
return this.routes.length;
}
}
exports.RouteMetadata = RouteMetadata;
//# sourceMappingURL=route-metadata.js.map