Linux command
miniflare 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Start local worker
miniflare [worker.js]
Specify port
miniflare [worker.js] --port [8787]
With KV namespace
miniflare [worker.js] --kv [NAMESPACE]
With D1 database
miniflare [worker.js] --d1 [DB]
With environment variables
miniflare [worker.js] --env [.env]
Watch for changes
miniflare [worker.js] --watch
说明
Miniflare is a simulator for Cloudflare Workers. It runs Workers locally with full support for KV, Durable Objects, R2, D1, and other Cloudflare services. Miniflare enables local development and testing without deploying to Cloudflare.
参数
- --port _port_
- HTTP port.
- --host _host_
- Bind address.
- --kv _namespace_
- KV namespace.
- --d1 _database_
- D1 database.
- --r2 _bucket_
- R2 bucket.
- --env _file_
- Environment file.
- --watch
- Watch for changes.
- --wrangler-config _file_
- Wrangler config.
FAQ
What is the miniflare command used for?
Miniflare is a simulator for Cloudflare Workers. It runs Workers locally with full support for KV, Durable Objects, R2, D1, and other Cloudflare services. Miniflare enables local development and testing without deploying to Cloudflare.
How do I run a basic miniflare example?
Run `miniflare [worker.js]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --port _port_ do in miniflare?
HTTP port.