Skip to content

Instantly share code, notes, and snippets.

View thenetaji's full-sized avatar
🎯
Vibing

thenetaji thenetaji

🎯
Vibing
View GitHub Profile
@thenetaji
thenetaji / index.js
Last active February 15, 2025 05:08
Using cloudflare d1 outside workers
import Cloudflare from "cloudflare";
import "dotenv/config";
const api_token = process.env.CLOUDFLARE_D1_ACCESS_TOKEN;
const account_id = process.env.CLOUDFLARE_ACCOUNT_ID;
const database_id = process.env.CLOUDFLARE_DB_ID;
const client = new Cloudflare({ apiToken: api_token });
async function runQuery(sql, params = []) {