Spaces:
Sleeping
Sleeping
Update server.ts
Browse files
server.ts
CHANGED
|
@@ -2,15 +2,18 @@ import Koa from "koa";
|
|
| 2 |
|
| 3 |
const app = new Koa();
|
| 4 |
|
|
|
|
|
|
|
| 5 |
app.use(async (ctx) => {
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
| 14 |
};
|
| 15 |
});
|
| 16 |
|
|
|
|
| 2 |
|
| 3 |
const app = new Koa();
|
| 4 |
|
| 5 |
+
let headers;
|
| 6 |
+
|
| 7 |
app.use(async (ctx) => {
|
| 8 |
+
if (ctx.request.url.startsWith("/img/")) {
|
| 9 |
+
ctx.body = "no image";
|
| 10 |
+
headers = Object.fromEntries(Object.entries(ctx.request.headers));
|
| 11 |
+
return;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
console.log(ctx.request.url, ctx.request.method);
|
| 15 |
+
ctx.body = {
|
| 16 |
+
headers,
|
| 17 |
};
|
| 18 |
});
|
| 19 |
|