Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate src/controllers/ping.js to ts #37

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions src/controllers/ping.js
Original file line number Diff line number Diff line change
@@ -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);
}
});
};
17 changes: 17 additions & 0 deletions src/controllers/ping.ts
Original file line number Diff line number Diff line change
@@ -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);
}
};
Loading