/**
 * Example controller
 *
 * created by Sean Maxwell Apr 14, 2019
 */ import { Request , Response } from 'express' ; import { Controller , Middleware , Get , Put , Post , Delete } from '@overnightjs/core' ; import { Logger } from '@overnightjs/logger' ; @ Controller ( 'api' ) export class ExampleController { @ Get ( ':msg' ) private getMessage ( req , res ) { Logger . Info ( req . params . msg ) ; res . status ( 200 ) . json ( { message : req . params . msg , } ) ; } @ Put ( ':msg' ) private putMessage ( req , res ) { Logger . Info ( req . params . msg ) ; return res . status ( 400 ) . json ( { error : req . params . msg , } ) ; } @ Post ( ':msg' ) private postMessage ( req , res ) { Logger . Info ( req . params . msg ) ; return res . status ( 400 ) . json ( { error : req . params . msg , } ) ; } @ Delete ( ':msg' ) private delMessage ( req , res ) { try { throw new Error ( req . params . msg ) ; } catch ( err ) { Logger . Err ( err , true ) ; return res . status ( 400 ) . json ( { error : req . params . msg , } ) ; } } }