import { injectable } from 'inversify' ; import { RequestStartMiddleware , Request , Response , NextFunction , RequestEndMiddleware } from '../../../../index' ; @ injectable ( ) export class StartMiddleware extends RequestStartMiddleware { invoke ( request , response , next ) { response . locals . data = [ ] ; response . locals . data . push ( 'This is StartMiddleWareOne' ) ; next ( ) ; } } @ injectable ( ) export class ResponseMiddleware extends RequestEndMiddleware { invoke ( request , response , next , result ) { response . locals . data . push ( 'This is ResponseMiddleWare' ) ; response . json ( { result : result , locals : response . locals . data } ) ; } }