Grant和Passport.js 有什么区别?什么时候应该使用 Grant 而不是passport.js,反之亦然?
如果我想制作社交媒体并跟踪用户活动并将其发布在新闻提要上,我应该使用哪个?格兰特还是passport.js?
回调参数的目的是什么res.render?
在什么情况下,由于模板已被指定为第一个参数,因此人们会想要使用这样的回调参数?
这是文档中的代码:
// send the rendered view to the client
res.render('index');
// if a callback is specified, the rendered HTML string has to be sent explicitly
res.render('index', function(err, html) {
res.send(html);
});
// pass a local variable to the view
res.render('user', { name: 'Tobi' }, function(err, html) {
// ...
});
Run Code Online (Sandbox Code Playgroud)
我理解前两个论点的目的,但不明白最后一个。