import { ApiController , Controller , HttpGet , Async , Parse , toInteger , toNumber , toBoolean } from '../../../../index' ; import { throwException } from '../parse-handlers/handlers' ; import { ControllerParseErrorMiddleware } from '../middlewares/filters' ; @ Controller ( '/about' , { exceptions : [ ControllerParseErrorMiddleware ] } ) export class AboutController extends ApiController { @ HttpGet ( '/parseException/:id' ) parseException ( @ Parse ( throwException ) id ) { return { message : '.jpg added to photo, and id must be converted to number' } ; } @ Async ( ) @ HttpGet ( '/asyncParseException/:id' ) async asyncParseException ( @ Parse ( throwException ) id ) { return '.jpg added to photo, and id must be converted to number' ; } @ HttpGet ( '/toInteger/:id' ) toInteger ( @ Parse ( toInteger ) id ) { return { id : id , msg : 'Built-in Converter to integer' } ; } @ HttpGet ( '/toNumber/:id' ) toNumber ( @ Parse ( toNumber ) id ) { return { id : id , msg : 'Built-in Converter to number' } ; } @ HttpGet ( '/toBoolean/:id' ) toBoolean ( @ Parse ( toBoolean ) id ) { return { id : id , msg : 'Built-in Converter to boolean' } ; } }