From 99614f8f3a11b112c6411f7a710f8833ae51d0cc Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sun, 26 Jul 2020 21:20:49 +0200 Subject: [PATCH] Add media upload route to MediaController Signed-off-by: David Mehren --- src/api/public/media/media.controller.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/api/public/media/media.controller.ts b/src/api/public/media/media.controller.ts index d5bba9347..97e1ed21c 100644 --- a/src/api/public/media/media.controller.ts +++ b/src/api/public/media/media.controller.ts @@ -1,4 +1,19 @@ -import { Controller } from '@nestjs/common'; +import { + Controller, + Logger, + Post, + UploadedFile, + UseInterceptors, +} from '@nestjs/common'; +import { FileInterceptor } from '@nestjs/platform-express'; @Controller('media') -export class MediaController {} +export class MediaController { + private readonly logger = new Logger(MediaController.name); + + @Post('upload') + @UseInterceptors(FileInterceptor('file')) + uploadImage(@UploadedFile() file) { + this.logger.debug('Recieved file: ' + file); + } +}