Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arichiardi/cloudflare-workers
Various workers that I need in personal projects.
https://github.com/arichiardi/cloudflare-workers
Last synced: 22 days ago
JSON representation
Various workers that I need in personal projects.
- Host: GitHub
- URL: https://github.com/arichiardi/cloudflare-workers
- Owner: arichiardi
- License: unlicense
- Created: 2022-07-14T16:51:51.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-14T20:40:43.000Z (over 2 years ago)
- Last Synced: 2024-10-22T13:56:29.806Z (2 months ago)
- Language: Clojure
- Size: 42 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cloudflare Workers
Various workers that I need in personal projects.
## Development
The current implementation relies on [ClojureScript](https://clojurescript.org/).
You'll need one terminal per command.
### Compile ClojureScript
In the project root:
``` shell
$ npm run watch> [email protected] watch
> shadow-cljs watch workersshadow-cljs - config: /home/cokap/git/cloudflare-workers/shadow-cljs.edn
shadow-cljs - server version
...
```### Bundle
``` shell
$ cd backblaze-download-token-to-secrets # or any other worker folder
$ npm run watch> [email protected] watch
> esbuild main.js --watch --bundle --platform=neutral --keep-names --format=esm --define:process.env.NODE_ENV="dev" --define:window=global --outfile=./out/bundle.js
...
```### Launch local server
We take advantage of [wrangler](https://github.com/cloudflare/wrangler2)'s development server:
``` shell
$ cd backblaze-download-token-to-secrets # or any other worker folder
$ npm run dev> [email protected] dev
> wrangler dev --local
...
```### Try it out
You can use `curl` for triggering the desired workers, for instance this is what you would run for a [Scheduled](https://developers.cloudflare.com/workers/runtime-apis/scheduled-event/) worker.
``` shell
$ curl "http://localhost:8787/cdn-cgi/mf/scheduled"
```Check the [miniflare](https://miniflare.dev/core) documentation for more info.