cod.controller.ts 517 B

12345678910111213141516
  1. import { Body, Controller, Get, Post, Req } from '@nestjs/common'
  2. import { Request } from 'express'
  3. import { CodService } from './cod.service'
  4. @Controller('cod')
  5. export class CodController {
  6. constructor(private readonly codService: CodService) {}
  7. @Get('getcod')
  8. async getcod(@Req() req: Request) {
  9. return await this.codService.getCod(req.ip)
  10. }
  11. @Post('verifycod')
  12. async verifycod(@Req() req: Request, @Body() body: { cod: string }) {
  13. return await this.codService.verifyCod(req.ip, body.cod)
  14. }
  15. }