FIREBASE警告:用户回调引发了异常。 TypeError:req.next不是函数

时间:2017-07-07 14:58:19

标签: node.js express firebase firebase-realtime-database ejs

我遇到了Firebase警告。 任何人都可以在这帮助我吗?

错误:TypeError:req.next不是函数

以下是我的数据库结构: my data structure

以下是我的代码:

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');

1 个答案:

答案 0 :(得分:1)

我的路线也出现同样的错误,如果您有任何帮助,请告诉我们, 这是代码

.settings