我是nodejs的新手,正在学习Koa。我对此代码有一些疑问。
const Koa = require('koa');
const app = new Koa();
app.use(async function(ctx,next) {
await next();
if (ctx.body || !ctx.idempotent) return ;
ctx.status = 404;
});
await next()和之后的if语句是什么意思?
我是nodejs的新手,正在学习Koa。我对此代码有一些疑问。
const Koa = require('koa');
const app = new Koa();
app.use(async function(ctx,next) {
await next();
if (ctx.body || !ctx.idempotent) return ;
ctx.status = 404;
});
await next()和之后的if语句是什么意思?