import { inject } from '@loopback/core' ; import { Request , RestBindings , get , ResponseObject , } from '@loopback/rest' ; /**
 * OpenAPI response for ping()
 */ const PING_RESPONSE = { description : 'Ping Response' , content : { 'application/json' : { schema : { type : 'object' , title : 'PingResponse' , properties : { greeting : { type : 'string' } , date : { type : 'string' } , url : { type : 'string' } , headers : { type : 'object' , properties : { 'Content-Type' : { type : 'string' } , } , additionalProperties : true , } , } , } , } , } , } ; /**
 * A simple controller to bounce back http requests
 */ export class PingController { constructor ( @ inject ( RestBindings . Http . REQUEST ) private readonly req ) { } @ get ( '/ping' , { responses : { '200' : PING_RESPONSE , } , } ) ping ( ) { return { greeting : 'Hello from LoopBack' , date : new Date ( ) , url : this . req . url , headers : Object . assign ( { } , this . req . headers ) , } ; } }