我被困在Firebase警告中。
有人可以在这里帮助我吗?
错误:TypeError:req.next不是函数
下面是我的数据库结构:
下面是我的代码:
var user = null;
user = req.session.user,
user_id = req.session.user_id;
session = req.session;
session.admin = 1;
session.current = 'subscription';
var db = firebase.database();
var ref = null;
var unix = Math.round(+new Date()/1000);
if(req.body.url) {
// Code for update particular state from the country
console.log(req.body);
ref = db.ref().child(req.body.url);
ref.on("value",function(snapshot) {
//res.send(snapshot.ref);
ref.child(req.body.city_name).remove();
});
console.log("Log History :");
console.log("/countryMaster/" + req.body.country_name + "/countyMaster");
console.log(req.body);
db = firebase.database();
ref = db.ref().child("/countryMaster/" + req.body.country_name + "/countyMaster").child(req.body.state_name).set({
"createBy": "",
"createDate": unix,
"status": "1",
"updateBy": "",
"updateDate": unix
});
}else {
// Code for Add particular state from the country
var ref = db.ref().child("/countryMaster/" + req.body.country + "/countyMaster").child(req.body.state_name).set({
"createBy": "",
"createDate": unix,
"status": "1",
"updateBy": "",
"updateDate": unix
});
}
res.redirect('/city');
最佳答案
我的路线也遇到了同样的错误,如果您有任何帮助,请告诉我们,
这是代码
router.post('/UpdateStatus', function(req, res) {
if(sess){
var id = req.body.id;
var type = req.body.type;
var status = req.body.status;
if(type == "licence"){
var up = TableUser.child(id).update({
licenceStatus:status
});
if(up){
//res.redirect('/drivers');
res.render('d');
}else{
console.log("error updating code");
}
}
}else{
res.redirect('/');
}
});
关于node.js - FIREBASE警告:用户回调引发了异常。 TypeError:req.next不是函数,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44973943/