(create-handler spec-path)(create-handler spec-path extensions)Load spec-path and return a Ring handler ready to mount in any server. Use this when embedding BFF as a library in your own application.
extensions is the immutable extension config for this handler. Keys
(all optional):
:enrichers — ordered seq of context enrichers :validators — {"key" impl} looked up by :validator {:key ...} refs :transformers — {"key" impl} :resolvers — {"key" impl} :retry-hooks — {"key" impl} :cache — a bff.cache/CacheStore, or nil
Example: (require '[bff.core :as bff])
(def handler (bff/create-handler "my-spec.yaml" {:validators {"check-order" my-validator} :cache my-cache-store}))
;; plug handler into your existing Ring/Jetty/http-kit server
Load spec-path and return a Ring handler ready to mount in any server.
Use this when embedding BFF as a library in your own application.
`extensions` is the immutable extension config for this handler. Keys
(all optional):
:enrichers — ordered seq of context enrichers
:validators — {"key" impl} looked up by :validator {:key ...} refs
:transformers — {"key" impl}
:resolvers — {"key" impl}
:retry-hooks — {"key" impl}
:cache — a bff.cache/CacheStore, or nil
Example:
(require '[bff.core :as bff])
(def handler
(bff/create-handler
"my-spec.yaml"
{:validators {"check-order" my-validator}
:cache my-cache-store}))
;; plug handler into your existing Ring/Jetty/http-kit servercljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |