@Produces

export declare let Produces: (value: string) => 
(Class: any, key: string, descriptor: PropertyDescriptor) => any;

@Produces is used as action decorator in order to declare content type header.

@Action("not_found")
@Produces("application/json")
dynamicRouterExample(): string {
  this.request.setStatusCode(Status.Not_Found);
  let params = {
    message: "NOT FOUND WITH DYNAMIC ROUTER EXAMPLE",
    params: this.request.getParams()
  };
  return JSON.stringify(params);
}

Content type header can be declared explicitly or via @Inject(Request) reflection api.

results matching ""

    No results matching ""