您好我正在與護照和mongodb登錄本地會話的節點,我得到了一個synthax錯誤,但我找不出原因? js/missing中的Synthax錯誤)參數列表後
它是一種奇怪的,因爲我覺得我爲了
這裏這裏是我的代碼了每一件事情......
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
}
一如既往真的感謝您的幫助
'fuction' =>'function'和'retrun' =>'return'。 – alexmac