Introduces a very basic version getting endpoint
All checks were successful
continuous-integration/drone/pr Build is passing

ref #91
This commit is contained in:
Nicolai Ort 2021-01-12 17:41:42 +01:00
parent 295a1524d8
commit a2f4fd5d9b

View File

@ -1,11 +1,12 @@
import { Get, JsonController } from 'routing-controllers'; import { Get, JsonController } from 'routing-controllers';
import { OpenAPI } from 'routing-controllers-openapi'; import { OpenAPI } from 'routing-controllers-openapi';
import { getConnection } from 'typeorm'; import { getConnection } from 'typeorm';
import { config } from '../config';
@JsonController('/status') @JsonController()
export class StatusController { export class StatusController {
@Get() @Get('/status')
@OpenAPI({ description: "A very basic status/health endpoint that just checks if the database connection is available. <br> The available information depth will be expanded later." }) @OpenAPI({ description: "A very basic status/health endpoint that just checks if the database connection is available. <br> The available information depth will be expanded later." })
get() { get() {
let connection; let connection;
@ -19,4 +20,12 @@ export class StatusController {
"database connection": "✔" "database connection": "✔"
}; };
} }
@Get('/version')
@OpenAPI({ description: "A very basic endpoint that just returns the curent package version." })
getVersion() {
return {
"version": config.version
}
}
} }