search

Home  >  Q&A  >  body text

node.js - express 路由一直报错

天蓬老师天蓬老师2868 days ago443

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 15:06:13

    1. Make sure your common.jsimport path is correct

    2. Confirm whether an error is reported in your requestCombine(req,res,next,x) method

    3. Personally I think it’s your path problem

    reply
    0
  • PHPz

    PHPz2017-04-17 15:06:13

    // catch 404 and forward to error handler
    app.use(function(req, res, next) {
        let err = new Error('Not Found');
        err.status = 404;
        console.error('WRONG:', '404 Not Found');
        next(err);
    });

    As soon as you add this middleware, all requests will receive a new 404 error, and then throw it out. You need to add a restriction before throwing the error.

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 15:06:13

    It’s a grammatical error at first glance!

    reply
    0
  • Cancelreply