1.2 Controllers

Typeix follows Model–view–controller (MVC) software architectural pattern for implementing user interfaces on computers. It divides a given application into three interconnected parts in order to separate internal representations of information from the ways that information is presented to and accepted from the user.

@Controller is instantiated and destroyed on each request.

export interface IControllerMetadata {
 name: string;
 filters?: Array<TFilter>;
 providers?: Array<IProvider|Function>;
}

Each service which is added in to providers at

@Controller is instantiated on each request as well, controllers support inheritance and actions are inherited as well.

Controller decorators:

  • @Action(name)
  • @Before(actionName)
  • @After(actionName)
  • @BeforeEach
  • @AfterEach
  • @Param
  • @Chain
  • @Produces
  • @Inject

Controller supports action chains on each chain you can stop chain propagation.

Action decorators:

  • @BeforeEach - we trigger before each action
  • @Before(name) - we trigger before action
  • @Action(name) - we provide action name defined by router
  • @After(name) - we trigger after action
  • @AfterEach - we trigger after each action

Action parameter decorators:

  • @Chain - contains chained data
  • @Param(name) - is used in actions itself to get data from path defined by router

Dependency injection decorators:

  • @Inject(name) - provide injection by token / string

results matching ""

    No results matching ""