大家好!我在理解鲍西斯(https://github.com/wprl/baucis)方面遇到一些问题。在中间件部分,我发现请求可以有 isAuthenticated() 方法,但我在文档中没有找到有关它的任何信息,并且在调用它时出现错误。我需要自己在代码中实现这个方法吗?我的代码:
var citySchema = new mongoose.Schema({
name: String
});
mongoose.model('City', citySchema);
var citiesController = baucis.rest('City');
citiesController.request(function (req, res, next) {
if (req.isAuthenticated()) return next();
return res.send(401);
});
最佳答案
感谢您的提问。
这是不可运行的示例代码。 passport中间件模块添加了 isAuthenticated 方法来请求,尽管使用 baucis 您可以自由使用 whatever authentication middleware你愿意。
呵呵!
关于javascript - 鲍西斯 + Node.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25611051/