2 ============LICENSE_START==========================================
3 ===================================================================
4 Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
5 ===================================================================
7 Unless otherwise specified, all software contained herein is licensed
8 under the Apache License, Version 2.0 (the License);
9 you may not use this software except in compliance with the License.
10 You may obtain a copy of the License at
12 http://www.apache.org/licenses/LICENSE-2.0
14 Unless required by applicable law or agreed to in writing, software
15 distributed under the License is distributed on an "AS IS" BASIS,
16 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 See the License for the specific language governing permissions and
18 limitations under the License.
19 ============LICENSE_END============================================
22 import { Request, RestBindings, get, ResponseObject } from '@loopback/rest';
23 import { inject } from '@loopback/context';
26 * OpenAPI response for ping()
28 const PING_RESPONSE: ResponseObject = {
29 description: 'Ping Response',
35 greeting: { type: 'string' },
36 date: { type: 'string' },
37 url: { type: 'string' },
41 'Content-Type': { type: 'string' },
43 additionalProperties: true,
52 * A simple controller to bounce back http requests
54 export class PingController {
55 constructor(@inject(RestBindings.Http.REQUEST) private req: Request) { }
64 // Reply with a greeting, the current time, the url, and request headers
66 greeting: 'Hello from LoopBack',
69 headers: Object.assign({}, this.req.headers),