Skip to content

Commit

Permalink
feat: bind target function before routing
Browse files Browse the repository at this point in the history
  • Loading branch information
aaydin-tr committed Aug 9, 2024
1 parent a907248 commit b7fdd66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export function getRoutesFromGroups(config: Config, groups: Group[]): Route[] {
if (route == null) return;
if (typeof route !== "function" && typeof route !== "object") return;

route.target = controller;
route.target = controller[route.fnName].bind(controller);
let path = route.path;
let before = route.before;
if (prefix) path = prefix + path;
Expand Down Expand Up @@ -219,7 +219,7 @@ export function getRoutesFromControllers(
if (route == null) return;
if (typeof route !== "function" && typeof route !== "object") return;

route.target = controller;
route.target = controller[route.fnName].bind(controller);
let path = route.path;
if (config.prefix) {
path = config.prefix + path;
Expand Down

0 comments on commit b7fdd66

Please sign in to comment.