This commit is contained in:
2023-03-18 06:58:43 +00:00
parent d24fc57962
commit d4b51f9803
4 changed files with 43 additions and 1 deletions

28
functions/e/[id].ts Normal file
View File

@ -0,0 +1,28 @@
interface Env {
KV: KVNamespace;
}
interface RawEvent {
id: string,
content: string,
created_at: string,
pubkey: string
}
export const onRequest: PagesFunction<Env> = async (context) => {
const id = context.params.id as string;
const next = await context.next();
console.debug(next.status);
console.debug("Fetching data for: ", id);
const rsp = await fetch(`https://api.snort.social/api/v1/raw/e/${id}`);
console.debug(rsp.status, rsp.statusText);
if (rsp.ok) {
const json: RawEvent = await rsp.json();
console.debug(json);
}
return new Response("test");
}

8
functions/tsconfig.json Normal file
View File

@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"lib": ["esnext"],
"types": ["@cloudflare/workers-types"]
}
}