Skip to content
Snippets Groups Projects
newsletter.controller.ts 645 B
Newer Older
  • Learn to ignore specific revisions
  • import { Body, Controller, Post } from '@nestjs/common';
    
    import { ApiTags } from '@nestjs/swagger';
    
    import { NewsletterService } from './newsletter.service';
    
    
    @ApiTags('newsletter')
    
    @Controller('newsletter')
    export class NewsletterController {
      constructor(private newsletterService: NewsletterService) {}
    
      @Post('subscribe')
      public async newsletterSubscribe(@Body() email: { email: string }) {
        return this.newsletterService.newsletterSubscribe(email.email);
      }
    
      @Post('unsubscribe')
      public async newsletterUnsubscribe(@Body() email: { email: string }) {
        return this.newsletterService.newsletterUnsubscribe(email.email);
      }
    }