Run JavaScript code from Bluesky posts. Source
export default {
fetch(request) {
return new Response("Hello from Bluesky!");
}
}
export default {
async fetch(req, env) {
await env.DB.exec(`CREATE TABLE IF NOT EXISTS c(n INT);INSERT INTO c VALUES(1)`)
const r = await env.DB.prepare("SELECT COUNT(*)c FROM c").first()
return new Response(`Hits: ${r.c}`)
}
}
A library post exports a function:
export function greet(name) { return `Hello ${name}` }
Another post imports and uses it: View & Run
import { greet } from 'at://maxmcd.bsky.social/3mdxxvwx4r227';
export default {
fetch(request) {
return new Response(greet("World"));
}
}
Visit /:handle/:rkey to view and run code from a post.
Direct execution: /:handle/:rkey/~run
Request logs: /:handle/:rkey/~logs
at:// URIsenv.DB