youzanyun-devtool-worker
Version:
44 lines (43 loc) • 1.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const ip_1 = tslib_1.__importDefault(require("ip"));
const spring4js_nodejs_1 = require("spring4js-nodejs");
const BaseController_1 = tslib_1.__importDefault(require("../BaseController"));
let SystemController = class SystemController extends BaseController_1.default {
async heartbeat(ctx, next) {
return true;
}
async appServerExit(ctx, next) {
console.log('appServer/exit');
try {
await this.lifecyleService.shutdown();
}
catch (e) {
console.error(e);
}
setTimeout(_ => {
process.exit(0);
}, 500);
return true;
}
async getIp(ctx, next) {
return ip_1.default.address();
}
};
tslib_1.__decorate([
(0, spring4js_nodejs_1.Resource)()
], SystemController.prototype, "lifecyleService", void 0);
tslib_1.__decorate([
(0, spring4js_nodejs_1.Path)("appServer/heartbeat", spring4js_nodejs_1.HttpMethod.GET)
], SystemController.prototype, "heartbeat", null);
tslib_1.__decorate([
(0, spring4js_nodejs_1.Path)("appServer/exit", spring4js_nodejs_1.HttpMethod.GET)
], SystemController.prototype, "appServerExit", null);
tslib_1.__decorate([
(0, spring4js_nodejs_1.Path)("getIp", spring4js_nodejs_1.HttpMethod.GET)
], SystemController.prototype, "getIp", null);
SystemController = tslib_1.__decorate([
(0, spring4js_nodejs_1.Controller)("/api/common")
], SystemController);
exports.default = SystemController;