Skip to content

Instantly share code, notes, and snippets.

@lfender6445
Last active December 6, 2019 17:41
Show Gist options
  • Save lfender6445/783a362e75d6b1cad1e58100fceb84d6 to your computer and use it in GitHub Desktop.
Save lfender6445/783a362e75d6b1cad1e58100fceb84d6 to your computer and use it in GitHub Desktop.

https://developers.cloudflare.com/workers/about/how-it-works/

register for cloudflare

  • goto workers.dev to create your account
  • create a cloudflare account, verify your account thru email (IMPORTANT)

create a subdomain

after registration you are prompted to add a site

  • when prompted to add a site, click the menu and go back to home or the dashboard we are skipping this step
  • click workers, which will let you setup a free worker subdomain
    • eg typing example would give your account control to the content on example.workers.dev

after creating subdomain goback to your dashboard from main menu

get your token

access your profile in the upper right corner, goto api tokens

  • click view next to global api key
  • enter your password
  • copy your global api key to your text editor or somewhere you wont forget

setup cloudflare worker cli (aka wrangler)

 npm install -g @cloudflare/wrangler
 wrangler generate my-worker # this creates a folder, my-worker
 # if that doesnt work run the next line then try again
 # git config url."git://".insteadOf "https://"
 cd my-worker
 wrangler config
 # - prompted for email, enter it
 # - promoted for api key, enter it
 # - finally, edit `wrangler.toml` to add your account id
   # - this is the hash in your cloudinary account url URL in the browser dashboard
   # - looks something like dash.cloudflare.com/173492837asjkl where 173492837asjkl is your account id
# save file
wrangler whoami # should come back with a success message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment