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

How do i handle file uploads in NestJs Microservice

我可以在 Nestjs 微服务中处理文件上传吗?

由于微服务不使用 http req @FileInterceptor 或 Multer 将无法工作。 即使有解决方法,我也不知道。

请帮忙

有个概念叫Hybrid Application 在 nest.js。这使您能够侦听 HTTP 请求,以及使用连接的微服务。

像这样:

// 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);