A Clojurescript library to simplify the use with Cloudflare workers. Supports both synchronous and asynchronous responses. Clojureflare focuses on providing a simple way to use Clojurescript with Cloudflare workers.
Clojureflare currently provides three functions, documented here.
worker
, which routes as arguments and attaches the dispatcher to the worker eventsimulate-worker
, serving the same purpose. It acceps a request as a first argument and instead of responding to a worker event returns the response, which simplifies repl development. It avoids any dependencies that would limit the runtime to the browser.route
, creating a new route which expects three argument: method
(e.g. GET, POST), path
(such as /api/v1/ping) and handler (described below).The handler can currently be one of three types:
The request is of the form of
{:path "/test" :body "{\"key\":1}" :headers {}}
while the response map should similar to
{:body "{\"key\":1}" :headers {"Content-Type" "application/json"} :status 200}
Head over to the example-worker to create your first Clojurescript worker.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close