Node.js
发布时间:2022-04-24 发布网站:大佬教程 code.js-code.com
大佬教程收集整理的这篇文章主要介绍了node.js:在sails.js中使用multer上传文件,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_934_12
@module.export
s.http =
{
middleware:
{
/
***************************************************************************
* *
* The order in which middleware should be run for
http request
s. *
* (This Sails app's routes are handled by the "router" middleware below.) *
* *
***************************************************************************/
order: [
'cookieParser','session','fileMiddleware','bodyParser','compress','poweredBy','router','www','favicon',],/
***************************************************************************
* *
* The body parser that will handle incoming multipart
http request
s. *
* *
*
https://sailsj
s.com/con
fig/
http#?customizing-the-body-parser *
* *
***************************************************************************/
bodyParser: (function ()
{
const bodyParser =
require('body-parser'
);
bodyParser.json(
);
bodyParser.urlencoded(
{ extended: true }
);
return bodyParser(
);
})(),fileMiddleware: (function ()
{
const multer =
require('multer'
);
const upload = multer(
);
return upload.fields([
{ name: 'images' },
{ name: 'profile' },
{ name: 'cover' }]
);
})(),}
};
你可以试试这个.它将覆盖船长.
大佬总结
以上是大佬教程为你收集整理的node.js:在sails.js中使用multer上传文件全部内容,希望文章能够帮你解决node.js:在sails.js中使用multer上传文件所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。