How to set Koa HTTP response code
In order to set the HTTP response code using Koa, use ctx.status = ...
ctx.status = 403;
Full example:
const Koa = require("koa");
const app = new Koa();
app.use(async (ctx, next) => {
ctx.status = 403;
ctx.body = "Forbidden";
});
app.listen(3000);