From 2bca1603dd7f91ae3d1144af1493eb54bcbca0da Mon Sep 17 00:00:00 2001 From: Mythicaeda Date: Tue, 20 Aug 2024 16:26:22 -0700 Subject: [PATCH] Add `/version` endpoint (#105) Add /version endpoint --- src/packages/health/health.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/packages/health/health.ts b/src/packages/health/health.ts index 20d2252..aa7aff0 100644 --- a/src/packages/health/health.ts +++ b/src/packages/health/health.ts @@ -1,4 +1,5 @@ import type { Express } from 'express'; +import { getEnv } from '../../env.js'; export default (app: Express) => { /** @@ -29,4 +30,30 @@ export default (app: Express) => { const uptimeMinutes = process.uptime() / 60; res.json({ timestamp, uptimeMinutes }); }); + + /** + * @swagger + * /version: + * get: + * produces: + * - application/json + * responses: + * 200: + * description: Version metrics + * content: + * application/json: + * schema: + * properties: + * gateway_version: + * description: The current version of the Aerie Gateway. + * type: string + * summary: Get the current version of the Gateway and Database Schema + * tags: + * - Version + */ + app.get('/version', async (_, res) => { + res.json({ + version: getEnv().VERSION, + }); + }); };