diff --git a/src/controllers/ping.js b/src/controllers/ping.js index 68ca1d0..d36c10e 100644 --- a/src/controllers/ping.js +++ b/src/controllers/ping.js @@ -1,13 +1,28 @@ -'use strict'; - +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +// eslint-disable-next-line const nconf = require('nconf'); +// eslint-disable-next-line const db = require('../database'); - -module.exports.ping = async function (req, res, next) { - try { - await db.getObject('config'); - res.status(200).send(req.path === `${nconf.get('relative_path')}/sping` ? 'healthy' : '200'); - } catch (err) { - next(err); - } +// eslint-disable-next-line +module.exports.ping = function (req, res, next) { + return __awaiter(this, void 0, void 0, function* () { + try { + // eslint-disable-next-line + yield db.getObject('config'); + // eslint-disable-next-line + res.status(200).send(req.path === `${nconf.get('relative_path')}/sping` ? 'healthy' : '200'); + } + catch (err) { + // eslint-disable-next-line + next(err); + } + }); }; diff --git a/src/controllers/ping.ts b/src/controllers/ping.ts new file mode 100644 index 0000000..0d74b57 --- /dev/null +++ b/src/controllers/ping.ts @@ -0,0 +1,17 @@ +// eslint-disable-next-line +const nconf = require('nconf'); +// eslint-disable-next-line +const db = require('../database'); + +// eslint-disable-next-line +module.exports.ping = async function (req, res, next) { + try { + // eslint-disable-next-line + await db.getObject('config'); + // eslint-disable-next-line + res.status(200).send(req.path === `${nconf.get('relative_path')}/sping` ? 'healthy' : '200'); + } catch (err) { + // eslint-disable-next-line + next(err); + } +};