https://github.com/magiccube/my-cloudflare-services
Henry's daily services hosted on Cloudflare.
https://github.com/magiccube/my-cloudflare-services
Last synced: 11 months ago
JSON representation
Henry's daily services hosted on Cloudflare.
- Host: GitHub
- URL: https://github.com/magiccube/my-cloudflare-services
- Owner: MagicCube
- Created: 2020-02-11T03:23:44.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T14:42:02.000Z (about 3 years ago)
- Last Synced: 2025-01-24T13:25:48.082Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://my-cloudflare-services.you-fm.workers.dev/
- Size: 542 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ʕ •́؈•̀) `worker-typescript-template`
A batteries included template for kick starting a TypeScript Cloudflare worker project.
## 🔋 Getting Started
This template is meant to be used with [`wrangler`](https://github.com/cloudflare/wrangler). If you are not already familiar with the tool, we recommend that you install the tool and configure it to work with your [Cloudflare account](https://dash.cloudflare.com).
To generate using `wrangler`, run this command:
```bash
wrangler generate my-ts-project https://github.com/EverlastingBugstopper/worker-typescript-template
```
### 👩 💻 Developing
[`src/index.js`](https://github.com/EverlastingBugstopper/worker-typescript-template/blob/master/src/index.ts) calls the request handler in [`src/handler.ts`](https://github.com/EverlastingBugstopper/worker-typescript-template/blob/master/src/handler.ts), and will return the [request method](https://developer.mozilla.org/en-US/docs/Web/API/Request/method) for the given request.
### 🧪 Testing
This template comes with mocha tests which simply test that the request handler can handle each request method. `npm test` will run your tests.
### ✏️ Formatting
This template uses [`prettier`](https://prettier.io/) to format the project. To invoke, run `npm run format`.
### 👀 Previewing and Publishing
For information on how to preview and publish your worker, please see the `wrangler` [README](https://github.com/cloudflare/wrangler#%EF%B8%8F--publish).
## 🤢 Issues
If you run into issues with this specific project, please feel free to file an issue [here](https://github.com/EverlastingBugstopper/worker-typescript-template/issues). If the problem is with `wrangler`, please file an issue [here](https://github.com/cloudflare/wrangler/issues).
## ⚠️ Caveats
The `service-worker-mock` used by the tests is not a perfect representation of the Cloudflare Workers runtime. It is a general approximation. We recommend that you test with `wrangler preview` and in a staging environment to test things before deploying.