@sourceloop/ctrl-plane-tenant-management-service
Version:
Tenant Management microservice for SaaS control plane
68 lines • 2.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PingController = void 0;
const tslib_1 = require("tslib");
const core_1 = require("@loopback/core");
const rest_1 = require("@loopback/rest");
const loopback4_authorization_1 = require("loopback4-authorization");
/**
* 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
*/
let PingController = class PingController {
constructor(req) {
this.req = req;
}
// Map to `GET /ping`
ping() {
// 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: { ...this.req.headers },
};
}
};
exports.PingController = PingController;
tslib_1.__decorate([
(0, loopback4_authorization_1.authorize)({ permissions: ['*'] }),
(0, rest_1.get)('/ping', {
responses: {
[200 /* STATUS_CODE.OK */]: PING_RESPONSE,
},
}),
tslib_1.__metadata("design:type", Function),
tslib_1.__metadata("design:paramtypes", []),
tslib_1.__metadata("design:returntype", Object)
], PingController.prototype, "ping", null);
exports.PingController = PingController = tslib_1.__decorate([
tslib_1.__param(0, (0, core_1.inject)(rest_1.RestBindings.Http.REQUEST)),
tslib_1.__metadata("design:paramtypes", [Object])
], PingController);
//# sourceMappingURL=ping.controller.js.map