Skip to content

Commit 4468f83

Browse files
Merge pull request #51 from hivetown/feat/healthz
fix: put healthz in its own controller
2 parents c6926fd + 5313b82 commit 4468f83

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

public/umvoltoja.mp3

5.89 MB
Binary file not shown.

src/controllers/healthz.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Injectable } from '@decorators/di';
2+
import { Controller, Get, Response } from '@decorators/express';
3+
import * as Express from 'express';
4+
5+
@Controller('/healthz')
6+
@Injectable()
7+
export class HealthController {
8+
@Get('/')
9+
public getHealth(@Response() res: Express.Response) {
10+
return res.status(200).send('OK');
11+
}
12+
13+
@Get('/jpp')
14+
public getJpp(@Response() res: Express.Response) {
15+
return res.status(200).sendFile('umvoltoja.mp3', { root: `${__dirname}/../../public` });
16+
}
17+
}

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { WebhookController } from './controllers/webhook';
3535
import { NotificationController } from './controllers/notifications';
3636
import { Email } from './external/Email';
3737
import { ReportsController } from './controllers/reports';
38+
import { HealthController } from './controllers/healthz';
3839

3940
// ENV
4041
import { config } from 'dotenv-cra';
@@ -112,7 +113,8 @@ export const main = async () => {
112113
NotificationController,
113114
ProducersController,
114115
WebhookController,
115-
ReportsController
116+
ReportsController,
117+
HealthController
116118
]);
117119

118120
app.use('/', (_req, res) => {

0 commit comments

Comments
 (0)