Skip to content

@PostProcessor Decorator

Thiago Bustamante edited this page Feb 19, 2019 · 1 revision

Post Processors

It is possible to add a function to run after the handler on an endpoint. It is similar to PreProcessor, but executed after the endpoint service.

function logProcessor(req: express.Request): express.Request {
  console.log('Endpoint executed');
}

@Path('myservice')
export class MyService {
  
  @Path('test')
  @POST
  @PostProcessor(logProcessor)
  test(body: any) {
  }
}

PostProcessors can also be added to a class, applying it to all endpoints on the class

@Path('myservice')
@PostProcessor(logProcessor)
export class MyService {
  
  @Path('test')
  @POST
  test(body: any) {
  }
}