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.yamlindex b43ad81909..3ec355bd95 100644--- a/public/openapi/read.yaml+++ b/public/openapi/read.yaml@@ -66,6 +66,10 @@ tags:- name: otherdescription: Other one-off routes that do not fit in a section of their ownpaths:+ /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.yamlnew file mode 100644index 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.yamlnew file mode 100644index 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.jsindex 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);