简体   繁体   English

我如何处理 NestJs 微服务中的文件上传

[英]How do i handle file uploads in NestJs Microservice

Do do I handle file uploads in Nestjs Microservice?我是否在 Nestjs 微服务中处理文件上传?

Since microservice doesn't use http req @FileInterceptor or Multer will not work.由于微服务不使用 http req @FileInterceptor 或 Multer 将不起作用。 Even if there's a workaround I am unaware of it.即使有解决方法,我也不知道。

Kindly help请帮助

There is a concept called Hybrid Application in nest.js.在nest.js 中有一个概念叫做Hybrid Application Which enable you to listen for HTTP requests, as well as makes use of connected microservices.这使您能够侦听 HTTP 请求,并利用连接的微服务。

something like this:像这样的东西:

 // Create your regular nest application. const app = await NestFactory.create(ApplicationModule); // Then combine it with your microservice const ms = app.connectMicroservice({ transport: Transport.TCP, options: { host: '0.0.0.0', port: 6000 } }); await app.startAllMicroservicesAsync(); await app.listen(3000);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM