参数列表后的js / missing中的Synthax错误

时间:2017-08-26 14:56:55

标签: node.js mongodb mongoose passport.js passport-local

您好我在使用护照和mongodb的节点中进行登录本地会话,我收到了一个synthax错误,但我无法弄清楚原因? enter image description here

这是一种奇怪的原因,我认为我得到了所有的东西
这里是我的代码......



var localStrategy = require('passport-local').Strategy;
var User = require('../app/models/users');

module.exports = function(passport){
    //Serializing user
    passport.serializeUser(function(user,done){
      done(null, user.id);
    });


    passport.deserializeUser(function(id,done){
      User.findById(id, fuction(err,user){ //here it's the error D:
        done(err,user);
      });
    });

    passport.use('local-signup', new localStrategy({
      usernameField: 'username',
      passField:'pass'
      passReqToCallback: true
    },
    function(req,username, pass, done){
      process.nextTick(function(){
          User.findOne({'local.emial':email,},function(err,user){
            if(err){
              return done(err);
            }
            if(user){
              retrun done(null,false,req.flash('signupMessage','Thath email its already taken '));
            }else{
              var newUser = new User();
              newUser.local.username = username;
              newUser.local.pass = pass;

              newUser.save(function(err){
                if(err){
                  throw err;
                  return done(null,newUser);
                }
              })
            }
          });
      });
    }


  ));



    // end function
}



一如既往地感谢您的帮助

1 个答案:

答案 0 :(得分:0)

fuction更正为function