Cloudflare D1 with Node.js (Outside Workers & Pages)
Setup
- Install dependencies:
npm install cloudflare dotenv
- Create a .env file:
CLOUDFLARE_D1_ACCESS_TOKEN=your_api_token CLOUDFLARE_ACCOUNT_ID=your_account_id CLOUDFLARE_DB_ID=your_database_id
Now you can execute SQL queries in Cloudflare D1 from your Node.js app.