如何与摇摇欲坠地使用multer?

时间:2019-12-17 16:29:07

标签: node.js express upload swagger multer

我一直在浏览multer文档。这就是我们可以使用multer在服务器上上传文件的方法(使用nodeJs和express):

app.post('/profile', upload.single('avatar'), function (req, res, next) {
  // req.file is the `avatar` file
  // req.body will hold the text fields, if there were any
})

但是在使用swagger(带有快速框架)时,我们只能在路由处理程序的参数中包含(req,res),如下所示: 功能routeHandler(req,res)。如何在招摇的路由处理程序中添加额外的参数 upload.single('avatar')


或者还有另一种使用摇摇欲坠的multer吗?

0 个答案:

没有答案