difference between 'done' and 'next' in node.js callbacks

前端 未结 4 1469
情歌与酒
情歌与酒 2020-12-24 03:27

in the passport [configure authentication] documentation, it has a rather scary-looking function that uses the mysterious function \"done.\'

passport.use(new         


        
4条回答
  •  Happy的楠姐
    2020-12-24 03:54

    passport's done() wants you to pass in an error (or null) for the first param and a user object as the 2nd param.

    express's next() wants an error in the first param or to be called with no parameter at all if there wasn't an error. you could also pass the name of a route to redirect control to in the first parameter but this isn't very common

提交回复
热议问题