Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jan 22, 2024
1 parent e68432b commit fe75b7f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# Cloudflare Bindings for Nitro and Nuxt

This is a proof of concept module to enable access to the Cloudflare runtime bindings in the development server of [Nitro](https://nitro.unjs.io) and [Nuxt](https://nuxt.com) using the new `getBindingsProxy` API exposed by wrangler and [miniflare](https://miniflare.dev/)

> [!WARNING]
> The `getBindingsProxy` API is not yet part of the wrangler, we are just using the prerelease from: https://github.com/cloudflare/workers-sdk/pull/4523. The utility's API can still change
This proof of concept module enables access to the Cloudflare runtime bindings in the development server of [Nitro](https://nitro.unjs.io) and [Nuxt](https://nuxt.com) using the [new `getBindingsProxy` API](https://github.com/cloudflare/workers-sdk/pull/4523) exposed by wrangler (Beta) and [miniflare](https://miniflare.dev/)

> [!NOTE]
> Nitro project plans to introduce a new method to allow native dev presets, meaning you can natively run [miniflare](https://miniflare.dev/) as your development server without this module or a proxy in the future.
> Nitro plans to introduce a new method to allow native dev presets, meaning you can natively run [miniflare](https://miniflare.dev/) as your development server without this module or a proxy in the future!
## Usage

Expand All @@ -26,17 +23,15 @@ yarn add -D wrangler@beta nitro-cloudflare-bindings
bun i -D wrangler@beta nitro-cloudflare-bindings
```

Then configure the module

**For [Nuxt](https://nuxt.com) projects:**
For **Nuxt** update `nuxt.config.ts`:

```js
export default defineNuxtConfig({
modules: ["nitro-cloudflare-bindings"],
});
```

**For [Nitro](https://nitro.unjs.io) projects:**
For **Nitro** update `nitro.config.ts`:

```js
import nitroCloudflareBindings from "nitro-cloudflare-bindings";
Expand All @@ -50,6 +45,8 @@ export default defineNitroConfig({

This module automatically finds the closest [`wrangler.toml`](https://developers.cloudflare.com/workers/wrangler/configuration/) file for configuration.

Data is persisted `.wrangler/state/v3` directory. On first use of the module, it will be automatically added to the `.gitignore` file.

## Development

- Clone this repository
Expand Down

0 comments on commit fe75b7f

Please sign in to comment.