From a2f4fd5d9b4a683d5eeb5133009e14227f8ee54c Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Tue, 12 Jan 2021 17:41:42 +0100 Subject: [PATCH] Introduces a very basic version getting endpoint ref #91 --- src/controllers/StatusController.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/controllers/StatusController.ts b/src/controllers/StatusController.ts index b867429..9f83c26 100644 --- a/src/controllers/StatusController.ts +++ b/src/controllers/StatusController.ts @@ -1,11 +1,12 @@ import { Get, JsonController } from 'routing-controllers'; import { OpenAPI } from 'routing-controllers-openapi'; import { getConnection } from 'typeorm'; +import { config } from '../config'; -@JsonController('/status') +@JsonController() export class StatusController { - @Get() + @Get('/status') @OpenAPI({ description: "A very basic status/health endpoint that just checks if the database connection is available.
The available information depth will be expanded later." }) get() { let connection; @@ -19,4 +20,12 @@ export class StatusController { "database connection": "✔" }; } + + @Get('/version') + @OpenAPI({ description: "A very basic endpoint that just returns the curent package version." }) + getVersion() { + return { + "version": config.version + } + } } \ No newline at end of file