Просмотр исходного кода

add swagger spec to healthcheck.js

Yuki Takei 7 лет назад
Родитель
Сommit
56c8abf568
1 измененных файлов с 28 добавлено и 0 удалено
  1. 28 0
      src/server/routes/apiv3/healthcheck.js

+ 28 - 0
src/server/routes/apiv3/healthcheck.js

@@ -9,6 +9,34 @@ const router = express.Router();
 const helmet = require('helmet');
 
 module.exports = (crowi) => {
+  /**
+   * @swagger
+   *
+   *  /healthcheck:
+   *    get:
+   *      description: Check whether the server is healthy or not
+   *      produces:
+   *        - application/json
+   *      parameters:
+   *        - name: connectToMiddlewares
+   *          in: query
+   *          description: Check also MongoDB and Elasticsearch
+   *          schema:
+   *            type: boolean
+   *      responses:
+   *        200:
+   *          description: Resources are available
+   *          content:
+   *            application/json:
+   *              schema:
+   *                properties:
+   *                  mongo:
+   *                    type: string
+   *                    description: 'OK'
+   *                  esInfo:
+   *                    type: object
+   *                    description: A result of `client.info()` of Elasticsearch Info API
+   */
   router.get('/', helmet.noCache(), async(req, res) => {
     const connectToMiddlewares = req.query.connectToMiddlewares;