Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrey Insidexa

View GitHub Profile
@Insidexa
Insidexa / readme.md
Last active Apr 20, 2020
NestJS / Tips & Tricks
View readme.md
View AppController.ts
@Controller()
export class AppController {
@ApiBody({ type: BodyDto, description: 'desc' })
@ApiConsumes('multipart/form-data')
@UseInterceptors(FileInterceptor('fileUpload'), new FileRequestMapperInterceptor('fileUpload'))
@Post()
example(
@Body() body: BodyDto,
): BodyDto {
console.log(body) // exists fileUpload
View example-interceptor.ts
import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common';
import { Observable } from 'rxjs';
@Injectable()
export class ExampleUploadInterceptor extends MulterInterceptor implements NestInterceptor {
private MAX_FILE_SIZE = 50 * 1024 * 1024;
constructor(
private fs: FsService,
) {
View deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-ci-cd
spec:
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1