@Before

export declare let Before: (value: string) => Function;

@Before decorator is used to bind route action name to method

@Controller({
   name: "home"
})
export class HomeController {


  @Before("index")
  async bforeIndexAction() {
    // do some business logic here or call multiple data sources and return it as one
    return [await "1", await "2", await "3"];
  }

  @Action("index")
  processIndexAction(@Chain data) {
      return "1" + data;
  }

}

This will match route home/index route or moduleName/home/index.

results matching ""

    No results matching ""