feat: backend API NestJS + Prisma + JWT auth + todos los módulos
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { Controller, Post, UseGuards, Req, UploadedFile, UseInterceptors } from '@nestjs/common';
|
||||
import { FileInterceptor } from '@nestjs/platform-express';
|
||||
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
||||
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||
import { StorageService } from './storage.service';
|
||||
|
||||
@ApiTags('Storage')
|
||||
@Controller('storage')
|
||||
export class StorageController {
|
||||
constructor(private storage: StorageService) {}
|
||||
|
||||
@Post('upload')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@UseInterceptors(FileInterceptor('file'))
|
||||
upload(@UploadedFile() file: any) {
|
||||
return { url: this.storage.getUploadUrl(file?.originalname) };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user