Skip to content

Node.js based forum software built for the modern web

refactor: add sping/ping into openapi

Barış Soner Uşaklı8ffbc35923cc
diff --git a/public/openapi/read.yaml b/public/openapi/read.yaml
index b43ad81909..3ec355bd95 100644
--- a/public/openapi/read.yaml
+++ b/public/openapi/read.yaml
@@ -66,6 +66,10 @@ tags:
- name: other
description: Other one-off routes that do not fit in a section of their own
paths:
+ /sping:
+ $ref: 'read/sping.yaml'
+ /ping:
+ $ref: 'read/ping.yaml'
/api/:
$ref: 'read/index.yaml'
/api/admin:
diff --git a/public/openapi/read/ping.yaml b/public/openapi/read/ping.yaml
new file mode 100644
index 0000000000..2000de8306
--- /dev/null
+++ b/public/openapi/read/ping.yaml
@@ -0,0 +1,13 @@
+get:
+ tags:
+ - ping
+ summary: Check if NodeBB is up
+ description: This route returns "200" and 200 status code if NodeBB is up and running.
+ responses:
+ "200":
+ description: ""
+ content:
+ text/plain:
+ schema:
+ type: string
+ example: "200"
diff --git a/public/openapi/read/sping.yaml b/public/openapi/read/sping.yaml
new file mode 100644
index 0000000000..9ef9642622
--- /dev/null
+++ b/public/openapi/read/sping.yaml
@@ -0,0 +1,13 @@
+get:
+ tags:
+ - ping
+ summary: Check if NodeBB is up
+ description: This route returns "healthy" and 200 status code if NodeBB is up and running.
+ responses:
+ "200":
+ description: ""
+ content:
+ text/plain:
+ schema:
+ type: string
+ example: "healthy"
diff --git a/src/controllers/ping.js b/src/controllers/ping.js
index dc4baed1f8..672c0e46e5 100644
--- a/src/controllers/ping.js
+++ b/src/controllers/ping.js
@@ -5,7 +5,7 @@ const db = require('../database');
module.exports.ping = async function (req, res, next) {
try {
- await db.getObject('config');
+ await db.getSortedSetRange('plugins:active', 0, 0);
res.status(200).send(req.path === `${nconf.get('relative_path')}/sping` ? 'healthy' : '200');
} catch (err) {
next(err);