deploy-worker
<br/> <p align="center"> <strong><code>🌤 deploy-worker</code></strong> </p>
Last updated a year ago by fouad .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install deploy-worker 
SYNC missed versions from official npm registry.

???? deploy-worker

Easiest way to compile
and deploy Cloudflare Workers.



deploy-worker --zone-id {zone-id} worker.js

Installation

Install with npm:

npm install --global deploy-worker

Or yarn:

yarn global add deploy-worker

Authentication

You need to pass in CF_EMAIL and CF_AUTH_Key as environment variables and then you can set CF_ZONE_ID/--zone-id and optionally CF_ACCOUNT_ID/--acount-id if you're an Enterprise customer.

Usage

Create a package.json to install modules you're using:

{
  "dependencies": {
    "node-emoji": "^1.1.0",
    "qs": "^6.7.0"
  }
}

Then create your .js or .ts file, like worker.js:

import qs from 'qs'
import { get as getEmoji } from 'node-emoji'

addEventListener(event => {
  let { request } = event
  let query = qs(request.url.split('?')[1] || '')
  let qsEmoji = query.get('emoji')
  let emoji = getEmoji(qsEmoji || 'star')

  event.respondWith(new Response(emoji))
})

Make sure your dependencies are installed, then run deploy-worker like this:

deploy-worker --zone-id {zone-id} worker.js

Congrats! You've deployed a Cloudflare Worker ????

Current Tags

  • 0.2.0                                ...           latest (a year ago)

2 Versions

  • 0.2.0                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 4
Dependencies (8)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |