From 210849eb74d5dca6c1f5cc5e3e1889a5b45fef13 Mon Sep 17 00:00:00 2001 From: Diana Lau Date: Mon, 23 Mar 2020 12:48:14 -0400 Subject: [PATCH] fix: remove ping controller --- .../acceptance/ping.controller.acceptance.ts | 26 ---------- .../validation-app/src/controllers/index.ts | 1 - .../src/controllers/ping.controller.ts | 52 ------------------- 3 files changed, 79 deletions(-) delete mode 100644 examples/validation-app/src/__tests__/acceptance/ping.controller.acceptance.ts delete mode 100644 examples/validation-app/src/controllers/ping.controller.ts diff --git a/examples/validation-app/src/__tests__/acceptance/ping.controller.acceptance.ts b/examples/validation-app/src/__tests__/acceptance/ping.controller.acceptance.ts deleted file mode 100644 index 372c38e7f1c5..000000000000 --- a/examples/validation-app/src/__tests__/acceptance/ping.controller.acceptance.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright IBM Corp. 2020. All Rights Reserved. -// Node module: @loopback/example-validation-app -// This file is licensed under the MIT License. -// License text available at https://opensource.org/licenses/MIT - -import {Client, expect} from '@loopback/testlab'; -import {ValidationApplication} from '../..'; -import {setupApplication} from './test-helper'; - -describe('PingController', () => { - let app: ValidationApplication; - let client: Client; - - before('setupApplication', async () => { - ({app, client} = await setupApplication()); - }); - - after(async () => { - await app.stop(); - }); - - it('invokes GET /ping', async () => { - const res = await client.get('/ping?msg=world').expect(200); - expect(res.body).to.containEql({greeting: 'Hello from LoopBack'}); - }); -}); diff --git a/examples/validation-app/src/controllers/index.ts b/examples/validation-app/src/controllers/index.ts index 13fd0280dacb..b9ded0fe0397 100644 --- a/examples/validation-app/src/controllers/index.ts +++ b/examples/validation-app/src/controllers/index.ts @@ -3,5 +3,4 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -export * from './ping.controller'; export * from './coffee-shop.controller'; diff --git a/examples/validation-app/src/controllers/ping.controller.ts b/examples/validation-app/src/controllers/ping.controller.ts deleted file mode 100644 index 7ecd04d50331..000000000000 --- a/examples/validation-app/src/controllers/ping.controller.ts +++ /dev/null @@ -1,52 +0,0 @@ -import {inject} from '@loopback/context'; -import {get, Request, ResponseObject, RestBindings} from '@loopback/rest'; - -/** - * OpenAPI response for ping() - */ -const PING_RESPONSE: ResponseObject = { - 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 req: Request) {} - - // Map to `GET /ping` - @get('/ping', { - responses: { - '200': PING_RESPONSE, - }, - }) - ping(): object { - // Reply with a greeting, the current time, the url, and request headers - return { - greeting: 'Hello from LoopBack', - date: new Date(), - url: this.req.url, - headers: Object.assign({}, this.req.headers), - }; - } -}