【发布时间】:2015-08-14 13:22:17
【问题描述】:
我正在使用此代码发出请求:
Request {
url: 'http://localhost:10002/asset/upload'
method: 'POST'
formData:
filename: fileName
code: imageCode
type: 'raw'
event_id: eventId
file: fs.createReadStream(filePath)
slug: "testing-the-stuff"
在我的快速应用程序中,我有这样一条路线:
app.post "/asset/upload", (req, res, next) ->
assetController.upload req, res, next
还有一个看起来像这样的控制器:
exports.upload = (req, res, next) ->
console.log req.body
res.json 'upload'
一切都很好,没有失败,但身体总是空的?我不确定是否有其他方法可以访问"formData"
作为参考,我使用bodyparser
【问题讨论】:
标签: node.js http express request body-parser