Skip to content
Snippets Groups Projects
email.controller.ts 550 B
Newer Older
  • Learn to ignore specific revisions
  • import { Controller, Post, Body } from '@nestjs/common';
    
    import { ContactForm } from './email';
    
    import { EmailService } from './email.service';
    import { ApiBadRequestResponse, ApiOkResponse } from '@nestjs/swagger';
    
    @Controller('email')
    export class EmailController {
    
      constructor(
        private emailService: EmailService,
      ) {}
    
    
      @Post('contact')
    
      @ApiOkResponse({ description: 'OK'})
      @ApiBadRequestResponse({ description: 'Missing fields'})
    
      create(@Body() contactForm: ContactForm) {
        return this.emailService.send(contactForm);