Spaces:
Sleeping
Sleeping
import Koa from "koa"; | |
const app = new Koa(); | |
let headers; | |
app.use(async (ctx) => { | |
if (ctx.request.url.startsWith("/img/")) { | |
ctx.body = "no image"; | |
headers = Object.fromEntries(Object.entries(ctx.request.headers)); | |
return; | |
} | |
console.log(ctx.request.url, ctx.request.method); | |
ctx.body = { | |
headers, | |
}; | |
}); | |
app.listen(7860); | |