在 node.js 中,为什么通行证会话无法触发“文件"事件?
问题描述:
在我的应用中我只使用
In my app I am only using
app.use(express.json());
app.use(express.urlencoded());
而不是
app.use(express.bodyParser());
以便我可以手动解析文件上传.好像这条线
so that I can manually parse file uploads. It seems that this line
app.use(passport.session());
阻止强大的触发文件事件:
stops formidable from triggering file events:
form.on('file', function(name, file) {
//never called
});
如何使用通行证会话而不与强大的文件事件发生冲突?
How can I use passport session and not clash with formidable file event?
答
看起来他们已经添加了解决此问题的方法.改用 app.use(passport.session({pauseStream: true}));
将防止异步反序列化破坏某些中间件.
Looks like they've added a way to fix this. Using app.use(passport.session({pauseStream: true}));
instead will prevent async deserializations from breaking some middleware.