Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@Header("x-token-test", "test")
@Header("x-token-test-2", "test2")
@Status(200)
@ContentType("application/xml")
@Deprecated()
testResponseHeader(@Request() request: Express.Request) {
return "";
}
@Post("/documents")
testMultipart(@MultipartFile("files") files: any[]) {
return files;
}
@Post("/documents/1")
@MulterFileSize(2048)
testMultipart2(@MultipartFile("file1") file: any) {
console.log("====>", file);
return "DONE";
}
}
import {Controller, Put, Status} from "@tsed/common";
import {MulterOptions, MultipartFile} from "@tsed/multipartfiles";
import {Responses} from "@tsed/swagger";
@Controller("/upload")
export class UploadController {
constructor() {
}
@Put("/")
@Status(201)
@Responses("201", {description: "Created"})
@Responses("400", {description: "Bad Request"})
@MulterOptions({dest: `${process.cwd()}/.tmp`})
async add(@MultipartFile("file") file: Express.Multer.File): Promise {
console.log("file: ", file);
return true;
}
}