摘要: 使用 try catch 来处理错误 const Koa = require('koa') const app = new Koa() app.use(async ctx => { try { JSON.parse('abc') ctx.body = 'Hello Koa' } catch (err 阅读全文
posted @ 2022-03-21 21:49 霸哥yyds 阅读(56) 评论(0) 推荐(0)
摘要: 下载 npm install koa-compose 使用 const Koa = require('koa') const compose = require('koa-compose') const app = new Koa() const a1 = (ctx, next) => { cons 阅读全文
posted @ 2022-03-21 21:07 霸哥yyds 阅读(92) 评论(0) 推荐(0)