diff --git a/Deploy-to-CF.md b/Deploy-to-CF.md new file mode 100644 index 0000000..ea71041 --- /dev/null +++ b/Deploy-to-CF.md @@ -0,0 +1,23 @@ +# Deploying SW.js to Cloudflare workers + +Deploying to cloudflare workers is the easier option to get up and running for free, you can do it by following the below + +1. Log into Cloudflare Dashboard +2. Create KV Namespace + * Under Workers > KV (left sidebar) + * Click "Create Namespace" + * Call it whatever you want, for this tutorial I'll be calling it KV + * Click "Add" +3. Create Cloudflare Worker + * Under Workers > Overview (left sidebar) + * Click "Create a Service" + * Change nothing, press "Create a Service" + * Go to Settings + * Under settings, go to variables + * Under KV Namespace Bindings, Click "Add binding" + * Variable Name: BARE, KV Namespace: KV (or whatever you called it) + * Click "Save and Deploy" + * Click "Quick Edit" on the top of the page + * If if freezes up while loading, just refresh and click quick edit again + * Paste your SW.js code in + * Click Save and Deploy diff --git a/README.md b/README.md index 04be7ff..753ff14 100644 --- a/README.md +++ b/README.md @@ -36,3 +36,5 @@ Output will contain: - dist/sw.js - All-in-one service worker. Automatically creates the Bare Server. - dist/index.js - ESM library. For use in environments where scripts can be imported. + +4. Deploy to cloudflare, follow the directions in [the cloudflare deployment guide](Deploy-to-CF.md)