跳到主要内容
CNode

koa-router 如何处理url没有的情况,默认redirect

问答
Ppetitspois发布于 12 年前最后回复 12 年前
1166890

ACB64B28-C15A-4DCC-86F9-1CA270FB3C81.png 新手见谅404页面处理

查看回复

回复 (1)

G
GuoZhang#112 年前

自己做middleware吧, 比如:

app.use(function *notFound(next) {
  if (this.status == 404) {
    console.log(this.url, 'requested but no route matches.');
  } else {
    yield next;
  }
});

参与回复

登录后即可参与回复。登录