diff --git a/public/umvoltoja.mp3 b/public/umvoltoja.mp3 new file mode 100644 index 0000000..7b7da90 Binary files /dev/null and b/public/umvoltoja.mp3 differ diff --git a/src/controllers/healthz.ts b/src/controllers/healthz.ts new file mode 100644 index 0000000..e8c2e63 --- /dev/null +++ b/src/controllers/healthz.ts @@ -0,0 +1,17 @@ +import { Injectable } from '@decorators/di'; +import { Controller, Get, Response } from '@decorators/express'; +import * as Express from 'express'; + +@Controller('/healthz') +@Injectable() +export class HealthController { + @Get('/') + public getHealth(@Response() res: Express.Response) { + return res.status(200).send('OK'); + } + + @Get('/jpp') + public getJpp(@Response() res: Express.Response) { + return res.status(200).sendFile('umvoltoja.mp3', { root: `${__dirname}/../../public` }); + } +} diff --git a/src/index.ts b/src/index.ts index f300c7e..a90f51f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,6 +35,7 @@ import { WebhookController } from './controllers/webhook'; import { NotificationController } from './controllers/notifications'; import { Email } from './external/Email'; import { ReportsController } from './controllers/reports'; +import { HealthController } from './controllers/healthz'; // ENV import { config } from 'dotenv-cra'; @@ -112,7 +113,8 @@ export const main = async () => { NotificationController, ProducersController, WebhookController, - ReportsController + ReportsController, + HealthController ]); app.use('/', (_req, res) => {