๐พ D1
Specify D1 Databases to add to your environment as follows:
const mf = new Miniflare({ d1Databases:{ DB:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" }});
For testing, it can be useful to put/get data from D1 storage
bound to a Worker. You can do this with the getD1Database
method:
const db = await mf.getD1Database("DB");const stmt = await db.prepare("<Query>");const returnValue = await stmt.run();
return Response.json(returnValue.results);
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark