Error: Route.get () got a [object Undefined]

1. Prompt

when calling middleware
Error: Route.get () requires a callback function but got a [object Undefined]

2. Add part of the code in the red box in the picture and report an error

3. Code file

server.js

var express = require("express");
domain = require("domain");
db = require("./db");
var order_search = require("./order_search");
var order_edit = require("./order_edit");
var cookieParser = require("cookie-parser");
var session = require("express-session");
var bodyParser = require("body-parser");
var app = express();
app.set("view engine", "ejs");
// app.use(cookieParser());
app.use(session({ resave: false, saveUninitialized: true, secret: "testApplication", cookie: { maxAge: 1200000 } }));
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
// app.use(bodyParser());
// app.use(app.router);
app.use("/images", express.static(__dirname + "/images/"));
app.use(function (err, req, res, next) {
    res.send(500, err.message);
});
app.get("/", order_search.get);
app.post("/search", order_search.search);
// app.get("/search", order_search.search);
app.get("/new", order_edit.new);
// app.get("/edit/:code", order_edit.search);
app.post("/edit", order_edit.add);
// app.post("/edit/:code", order_edit.update);
// app.post("/delete/:code", order_edit.delete);
app.get("/return", order_edit.return);
app.listen(80);

order_edit.js

exports.new = function(req, res){
    res.render("order_edit", {code:"", errMsg:null, successMsg:null});
}

exports.search = function(req, res, next){
    var d = domain.create();
    d.on("error", function(err){
        next(err);
    });
    d.run(function(){
        db.connect(function(){
            var order = {code:req.params.code};
            db.searchOrder(order, function(){
                db.disconnect();
                res.render("order_edit", {code:req.body.code, order:db.orders[0], errMsg:null, successMsg:null});
            })
        })
    })
}

exports.add = function(req, res, next){
    var d = domain.create();
    d.on("error", function(err){
        next(err);
    });

    d.run(function(){
        db.connect(function(){
            var order = new Object();
            order.code = req.body.code;
            order.date = new Date(req.body.date);
            order.goodsCode = req.body.goodsCode;
            order.brandName = req.body.brandName;
            order.num = req.body.num;
            order.price = req.body.price;
            order.personName = req.body.personName;
            order.email = req.body.email;
            db.addOrder(order, function(){
                db.disconnect();
                if(db.errMsg)
                res.render("order_edit", {code:req.body.code, order:order, errMsg:db.errMsg, successMsg:null});
                else
                res.render("order_edit", {code:req.body.code, order:order, errMsg:null, successMsg:null});
            })
        })
    })

    exports.update = function(req, res, next){
        var d = domain.create();
        d.on("error", function(err){
            next(err);
        })
        d.run(function(){
            db.connect(function(){
                var order = new Object();
                order.code = req.body.code;
                order.date = new Date(req.body.date);
                order.goodsCode = req.body.goodsCode;
                order.brandName = req.body.brandName;
                order.num = req.body.num;
                order.price = req.body.price;
                order.personName = req.body.personName;
                order.email = req.body.email;
                db.upadteOrder(order, function(){
                    db.disconnect();
                    res.render("order_edit", {code:req.body.code, order:order, successMsg:"", errMsg:null});
                })
            })
        })
    }

    exports.delete = function(req, res, next){
        var d = domain.create();
        d.on("error", function(err){
            next(err);
        });
        d.run(function(){
            db.connect(function(){
                var order = new Object();
                order.code = req.body.code;
                db.deleteOrder(order, function(){
                    db.disconnect();
                    if(req.session.code||req.session.date||req.session.goodsCode)
                    res.redirect("/search/");
                    else
                    res.render("order_search", {rows:new Array(), order:null})
                })
            })
        })
    }

    exports.return = function(req, res, next){
        if(req.session.code||req.session.date||req.session.goodsCode)
        {
            res.redirect("/search/")
        }
        else{
            res.render("order_search", {rows:new Array(), order:null})
        }
    }
}

4. Following the knock of the book, there is no problem with the other calls. As soon as this is added, it will make a mistake. I hope my friends can take a look at it.

Jul.22,2021

order_edit.js curly braces are improperly positioned so that the method cannot be recognized

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c211-2bb40.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c211-2bb40.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?