当我将mongoose-auth添加到我的server.js时,我得到以下异常,我不确定是什么问题。有人可以帮忙吗
exports.helpExpress = everyauth.helpExpress.bind(everyauth);
} has no method 'middleware'
at HTTPServer.<anonymous> (/home/x/x/settings.js:44:26)
at HTTPServer.configure (/home/x/x/node_modules/express/lib/http.js:543:61)
at bootApplication (/home/x/x/settings.js:27:7)
at Object.boot (/home/x/x/settings.js:21:3)
at Object.<anonymous> (/home/x/x/app.js:4:23)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array.0 (module.js:470:10)
答案 0 :(得分:0)
请参阅此帖子https://github.com/bnoguchi/mongoose-auth/issues/20(tsabolov最后的评论)。
在宣布Schema插件之后必须使用app.use(mongooseAuth.middleware())。