Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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 workers

shadow-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.