breakout into monorepo
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
deploy:
|
||||
npx wrangler deploy
|
||||
@@ -0,0 +1,17 @@
|
||||
export default {
|
||||
async fetch(request: Request, env: Env) {
|
||||
if (request.method !== "POST") {
|
||||
return new Response("Method Not Allowed", { status: 405 });
|
||||
}
|
||||
|
||||
const body = await request.json().catch(() => null);
|
||||
if (!body) return new Response("Bad Request", { status: 400 });
|
||||
|
||||
const key = `calc:${Date.now()}:${crypto.randomUUID()}`;
|
||||
await env.CALCULATOR_LOGGING.put(key, JSON.stringify(body));
|
||||
|
||||
return new Response(JSON.stringify({ ok: true, key }), {
|
||||
headers: { "content-type": "application/json" },
|
||||
});
|
||||
},
|
||||
} satisfies ExportedHandler<Env>;
|
||||
@@ -0,0 +1,5 @@
|
||||
fetch("https://kv-logger.xominus.workers.dev", {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({ "test": 1 })
|
||||
}).catch((e) => { console.error(e) });
|
||||
@@ -0,0 +1,7 @@
|
||||
name = "kv-logger"
|
||||
main = "src/index.ts"
|
||||
compatibility_date = "2025-10-17"
|
||||
|
||||
[[kv_namespaces]]
|
||||
binding = "CALCULATOR_LOGGING"
|
||||
id = "4b585549cf074f729d9ec4ac39e2c879"
|
||||
Reference in New Issue
Block a user