u
This commit is contained in:
@@ -7,10 +7,37 @@ import { ensureConnection } from '../../db/store.js';
|
||||
*/
|
||||
export function register(app, basePath = '') {
|
||||
/**
|
||||
* @route GET /health
|
||||
* @description Verifies the database client can establish a connection.
|
||||
* @returns {Object} 200 - `{ ok: true }` when the database is reachable
|
||||
* @returns {Object} 503 - `{ ok: false, error }` when the check fails
|
||||
* @openapi
|
||||
* /health:
|
||||
* get:
|
||||
* tags: [Health]
|
||||
* summary: Database health check
|
||||
* description: Verifies the database client can establish a connection.
|
||||
* security: []
|
||||
* x-markdown: health.md
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Database reachable
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* ok:
|
||||
* type: boolean
|
||||
* example: true
|
||||
* 503:
|
||||
* description: Database unreachable
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* ok:
|
||||
* type: boolean
|
||||
* example: false
|
||||
* error:
|
||||
* type: string
|
||||
*/
|
||||
app.get(`${basePath}/health`, async (_request, response) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user