I want to rewrite this function in to ES6 fat arrow, but not sure how?
passport.authenticate("local")(req, res, function(){
res.redirect("/secret");
});
I thought this might be the way but nope:
passport.authenticate("local")((req, res)=>{
res.redirect("/secret");
});
passport.authenticate("local")(req, res, () => {
res.redirect("/secret");
});
It can be done this way.
如果您不打算在箭头功能中进行任何其他操作,则可以这样做。
passport.authenticate("local")(req, res, () => res.redirect("/secret"));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.