Baucis + Node.js

今天是个好日子! 我对理解baucis有一些问题( https://github.com/wprl/baucis )。 在中间件部分,我发现请求可以有isAuthenticated()方法,但在文档中我没有find任何有关它的信息,并且在调用它的时候出错了。 我需要自己在我的代码中实现这个方法吗? 我的代码:

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); }); 

感谢您的问题。

这是不可运行的示例代码。 护照中间件模块添加了isAuthenticated方法来请求,但是使用baucis你可以自由地使用任何你想要的authentication中间件 。

HTH!

Interesting Posts