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

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

我被困在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/

相关文章:

javascript - 内部/模块/cjs/loader.js :800 throw err

node.js - 在 mongoose 中查找相对于我的坐标在 10 英里半径内的附近用户

node.js - 在 Express 中获取 POST 和 GET 请求的表单数据

javascript - 我可以在客户端使用 PostgreSQL (pg) (express/node.js)

javascript - 在 Firebase 中加载数据时运行 JQuery

javascript - Node.Js 中有海象运算符吗?

node.js - cordova build 命令失败,退出代码 EACCES

node.js - 如何使用 mongodb 命令删除字段内的 html 标签?

reactjs - 如何使用 Firebase/Firestore 将 componentDidMound 和 componentWillUnmount 转换为 UseEffect (React Hooks)?

android - react native Firebase : Trying to port to a new firebase project but app shows older values