Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cloudflare/worker-typescript-template
ʕ •́؈•̀) TypeScript template for Cloudflare Workers
https://github.com/cloudflare/worker-typescript-template
boilerplate cloudflare cloudflare-workers template typescript workers wrangler
Last synced: 3 days ago
JSON representation
ʕ •́؈•̀) TypeScript template for Cloudflare Workers
- Host: GitHub
- URL: https://github.com/cloudflare/worker-typescript-template
- Owner: cloudflare
- License: apache-2.0
- Created: 2019-07-16T17:19:41.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-25T22:54:32.000Z (4 months ago)
- Last Synced: 2024-10-29T19:58:06.409Z (3 months ago)
- Topics: boilerplate, cloudflare, cloudflare-workers, template, typescript, workers, wrangler
- Language: TypeScript
- Homepage:
- Size: 625 KB
- Stars: 429
- Watchers: 3
- Forks: 95
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE_APACHE
Awesome Lists containing this project
README
# ʕ •́؈•̀) `worker-typescript-template`
## ⚠️ Warning: This template is no longer maintained
Create TypeScript workers in the [command-line with Wrangler 2.0.0+](https://developers.cloudflare.com/workers/wrangler/get-started/) using `wrangler init` instead.
---
A batteries included, with the latest Wrangler, template for kick starting a TypeScript Cloudflare worker project.
## Note: You must use [wrangler](https://developers.cloudflare.com/workers/cli-wrangler/install-update) 1.17 or newer to use this template.
## 🔋 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). Documentation can be found [here](https://developers.cloudflare.com/workers/tooling/wrangler/).
To generate using Wrangler, run this command:
```bash
wrangler generate my-ts-project https://github.com/cloudflare/worker-typescript-template
```### 👩 💻 Developing
[`src/index.ts`](./src/index.ts) calls the request handler in [`src/handler.ts`](./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 jest tests utilizing [Miniflare](https://github.com/cloudflare/miniflare) 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 docs](https://developers.cloudflare.com/workers/tooling/wrangler/commands/#publish).
## 🤢 Issues
If you run into issues with this specific project, please feel free to file an issue [here](https://github.com/cloudflare/worker-typescript-template/issues). If the problem is with Wrangler, please file an issue [here](https://github.com/cloudflare/wrangler/issues).