diff options
Diffstat (limited to 'packages/integrations/cloudflare/README.md')
-rw-r--r-- | packages/integrations/cloudflare/README.md | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/integrations/cloudflare/README.md b/packages/integrations/cloudflare/README.md index 755451185..66f4fdd20 100644 --- a/packages/integrations/cloudflare/README.md +++ b/packages/integrations/cloudflare/README.md @@ -68,6 +68,18 @@ $ pnpm install wrangler --save-dev It's then possible to update the preview script in your `package.json` to `"preview": "wrangler pages dev ./dist"`.This will allow you run your entire application locally with [Wrangler](https://github.com/cloudflare/wrangler2), which supports secrets, environment variables, KV namespaces, Durable Objects and [all other supported Cloudflare bindings](https://developers.cloudflare.com/pages/platform/functions/#adding-bindings). +## Access to the cloudflare runtime + +You have the posibility to access all the cloudflare bindings and environment variables from your astro pages and api routes through the adapter API + +``` +import { getRuntime } from "@astrojs/cloudflare/runtime"; + +getRuntime(Astro.request); +``` + +Depending your adapter mode (advanced = worker, directory = pages) the runtime object will look a little different due to the difference in the cloudflare API. + ## Streams Some integrations such as [React](https://github.com/withastro/astro/tree/main/packages/integrations/react) rely on web streams. Currently Cloudflare Pages Functions require enabling a flag to support Streams. |