test-req / server.ts
coyotte508's picture
coyotte508 HF staff
Update server.ts
4f1472a verified
raw
history blame
491 Bytes
import Koa from "koa";
const app = new Koa();
app.use(async (ctx) => {
console.log(ctx.request.url, ctx.request.method);
ctx.body = {
fullUrl: ctx.request.url,
type: typeof ctx.request.url,
query: ctx.request.query,
s3url: await fetch('https://huggingface.co/gpt2/resolve/main/64.tflite', {redirect: "manual"}).then(r => r.headers.get("Location")),
headers: Object.fromEntries(Object.entries(ctx.request.headers)),
env: process.env
};
});
app.listen(7860);