From f1c0f3d3da28606eb3e83e2f5ff965eff82a3212 Mon Sep 17 00:00:00 2001 From: ProgrammerIn-wonderland <30693865+ProgrammerIn-wonderland@users.noreply.github.com> Date: Thu, 22 Dec 2022 15:06:15 -0500 Subject: [PATCH 1/2] Create Cloudflare Deployment Guide --- Deploy-to-CF.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Deploy-to-CF.md 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 From e676271ae48a8e2a20ecd78800e166830f6d8af2 Mon Sep 17 00:00:00 2001 From: ProgrammerIn-wonderland <30693865+ProgrammerIn-wonderland@users.noreply.github.com> Date: Thu, 22 Dec 2022 15:11:00 -0500 Subject: [PATCH 2/2] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) 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)