This commit is contained in:
Kieran 2023-03-18 06:58:43 +00:00
parent d24fc57962
commit d4b51f9803
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
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"]
}
}

View File

@ -8,6 +8,7 @@
"start": "yarn workspace @snort/nostr build && yarn workspace @snort/app start"
},
"devDependencies": {
"@tauri-apps/cli": "^1.2.3"
"@tauri-apps/cli": "^1.2.3",
"@cloudflare/workers-types": "^4.20230307.0"
}
}

View File

@ -1083,6 +1083,11 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@cloudflare/workers-types@^4.20230307.0":
version "4.20230307.0"
resolved "https://registry.yarnpkg.com/@cloudflare/workers-types/-/workers-types-4.20230307.0.tgz#58a20fe167a5c48e20edba8e1fbfe4231bcfa223"
integrity sha512-Go968aDDcqONHQcUdgIiPRkPdT4QTzD0ecHJsI1u7ZiHPMOoZn+Dy7hYsdUJ5ldX9wTZDrICBM1rDKTRaDUitg==
"@csstools/normalize.css@*":
version "12.0.0"
resolved "https://registry.yarnpkg.com/@csstools/normalize.css/-/normalize.css-12.0.0.tgz#a9583a75c3f150667771f30b60d9f059473e62c4"