An encoding of the most common API building case, allows building servers with a map of API command to handling function, leaving wiring to this
An encoding of the most common API building case, allows building servers with a map of API command to handling function, leaving wiring to this
(api-handler-fn definition dispatch-map)
The default handler function, at the end of a blueprint interceptor chain. When reached, a valid command has been parsed.
A provided dispatch map is looked up for the corresponding handler function and hands off to it.
The default handler function, at the end of a blueprint interceptor chain. When reached, a valid command has been parsed. A provided dispatch map is looked up for the corresponding handler function and hands off to it.
(command-map this)
Yield a partial dispatch map
Yield a partial dispatch map
(build)
(build this)
Builds a map describing a stopped API server,
ready for use by start
and stop
.
Acts as a component if wired to a system map.
No required checking of configuration yet, this is deferred
to start
in case dynamic wiring of dependencies
is done.
Builds a map describing a stopped API server, ready for use by `start` and `stop`. Acts as a component if wired to a system map. No required checking of configuration yet, this is deferred to `start` in case dynamic wiring of dependencies is done.
(build-dispatch-map {:blueprint.server/keys [dispatch-map dispatchers]
:as this})
Walk the collection of dispatcher paths, representing keys into the input map that should be looked up to find partial dispatch maps.
Elements found may implement BlueprintDispatcher or contain
a :blueprint.server/commands
key. When neither of these
are true, the map is returned as is.
All provided dispatchers are merged together and should be
a valid dispatch-map implementation (a map of keyword to
values implementing clojure.lang.IFn
.
Walk the collection of dispatcher paths, representing keys into the input map that should be looked up to find partial dispatch maps. Elements found may implement BlueprintDispatcher or contain a `:blueprint.server/commands` key. When neither of these are true, the map is returned as is. All provided dispatchers are merged together and should be a valid dispatch-map implementation (a map of keyword to values implementing `clojure.lang.IFn`.
(find-dispatcher this k)
(start {:blueprint.core/keys [definition]
:blueprint.handler/keys [handler]
:blueprint.server/keys [dispatchers dispatch-map]
:aleph.http/keys [port options]
:as this})
Start a server, expects the output of build-server
,
returns a modified map with an additional :aleph.http/server
key which holds the Aleph server.
Start a server, expects the output of `build-server`, returns a modified map with an additional `:aleph.http/server` key which holds the Aleph server.
(stop {:aleph.http/keys [server] :as http-server})
Stop a server, expects the output of build-server
. Returns
the input map without the ::http/server
key.
Stop a server, expects the output of `build-server`. Returns the input map without the `::http/server` key.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close