Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Deploy-to-CF.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)