Implement routes in MonitoringController

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2020-07-26 21:36:54 +02:00
parent 6617977a7e
commit 34d0578c0d
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
2 changed files with 17 additions and 2 deletions

View file

@ -1,4 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing';
import { MonitoringService } from '../../../monitoring/monitoring.service';
import { MonitoringController } from './monitoring.controller'; import { MonitoringController } from './monitoring.controller';
describe('Monitoring Controller', () => { describe('Monitoring Controller', () => {
@ -7,6 +8,7 @@ describe('Monitoring Controller', () => {
beforeEach(async () => { beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({ const module: TestingModule = await Test.createTestingModule({
controllers: [MonitoringController], controllers: [MonitoringController],
providers: [MonitoringService],
}).compile(); }).compile();
controller = module.get<MonitoringController>(MonitoringController); controller = module.get<MonitoringController>(MonitoringController);

View file

@ -1,4 +1,17 @@
import { Controller } from '@nestjs/common'; import { Controller, Get } from '@nestjs/common';
import { MonitoringService } from '../../../monitoring/monitoring.service';
@Controller('monitoring') @Controller('monitoring')
export class MonitoringController {} export class MonitoringController {
constructor(private monitoringService: MonitoringService) {}
@Get()
getStatus() {
return this.monitoringService.getServerStatus();
}
@Get('prometheus')
getPrometheusStatus() {
return '';
}
}