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

前端 未结 4 1458
情歌与酒
情歌与酒 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条回答
  •  伪装坚强ぢ
    2020-12-24 03:52

    next() will get the control flow to the next middleware, if there is.

    In Passport.js, Calling done() will make the flow jump back into passport.authenticate(). It's passed the error, user and additional info object (if defined).

    In other cases, done() will take the control flow to the next function after the function it was used in.

提交回复
热议问题