A Flake ID generation service provided as a Ring middleware.
blizzard
is available via Clojars:
[blizzard "0.3.1"]
Blizzard may be used either as a standalone HTTP service or as a Ring
middleware. In the case of the former, simply invoking lein run
is sufficient
to start the Ring server.
To use the Ring middleware, simply wrap the handler:
=> (require '[blizzard.core :as blizzard])
=> (def handler (-> (constantly {:status 404 :body "Not Found"})
blizzard/wrap-flake))
In either the standalone or middleware use case, the Ring application will provide two routes, /flake and /flake/:n which generate a single flake and N flakes, respectively.
Note that blizzard produces responses encoded with transit. Either JSON or Msgpack encodings may be produced. By default, JSON is used. To request a specific format, specify either application/json or application/x-msgpack in the Accept header, for JSON or Msgpack respectively.
When using the standalone server, environment variables provide runtime configuration:
BLIZZARD_HOST - Defaults to localhost.
BLIZZARD_PORT - Defaults to 3000.
BLIZZARD_MAX_IDS - The maximum allowed IDs per batch request. Default 1000.
BLIZZARD_JETTY_OPTS - Defaults to {:join? true}.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close