diff --git a/src/api/ping.controller.ts b/src/api/ping.controller.ts new file mode 100644 index 00000000..8d0a59c0 --- /dev/null +++ b/src/api/ping.controller.ts @@ -0,0 +1,13 @@ +import { Controller, Get } from '@nestjs/common'; +import { ApiOperation, ApiTags } from '@nestjs/swagger'; +import { PingResponse } from '@waha/structures/ping.dto'; + +@Controller('ping') +@ApiTags('other') +export class PingController { + @Get() + @ApiOperation({ summary: 'Ping the server, perform no operations.' }) + ping(): PingResponse { + return { message: 'pong' }; + } +} diff --git a/src/core/app.module.core.ts b/src/core/app.module.core.ts index b975ee9d..9b7d1ef8 100644 --- a/src/core/app.module.core.ts +++ b/src/core/app.module.core.ts @@ -18,6 +18,7 @@ import { ChattingController } from '../api/chatting.controller'; import { ContactsController } from '../api/contacts.controller'; import { GroupsController } from '../api/groups.controller'; import { HealthController } from '../api/health.controller'; +import { PingController } from '../api/ping.controller'; import { PresenceController } from '../api/presence.controller'; import { ScreenshotController } from '../api/screenshot.controller'; import { @@ -105,6 +106,7 @@ export const CONTROLLERS = [ ScreenshotController, VersionController, HealthController, + PingController, ]; const PROVIDERS = [ { diff --git a/src/structures/ping.dto.ts b/src/structures/ping.dto.ts new file mode 100644 index 00000000..5542db38 --- /dev/null +++ b/src/structures/ping.dto.ts @@ -0,0 +1,3 @@ +export class PingResponse { + message: string = 'pong'; +}