Liking cljdoc? Tell your friends :D

com.fulcrologic.fulcro.server.api-middleware


augment-mapclj

(augment-map response)

Fulcro queries and mutations can wrap their responses with augment-response to indicate they need access to the raw Ring response. This function processes those into the response.

Fulcro queries and mutations can wrap their responses with `augment-response` to indicate they need access to
the raw Ring response. This function processes those into the response.
sourceraw docstring

augment-responseclj

(augment-response core-response ring-response-fn)

Augments the Ring response that's returned from the handler.

Use this function when you need to add information into the handler response, for example when you need to add cookies or session data. Example:

(defmutation my-mutate
  ...
  (augment-response
    {:uid 42} ; your regular response
    #(assoc-in % [:session :user-id] 42))) ; a function resp -> resp

If the parser has multiple responses with augment-response they will be applied in order, the first one will receive an empty map as input. Only top level values of your response will be checked for augmented response (i.e. primarily mutation responses).

Augments the Ring response that's returned from the handler.

Use this function when you need to add information into the handler response, for
example when you need to add cookies or session data. Example:

    (defmutation my-mutate
      ...
      (augment-response
        {:uid 42} ; your regular response
        #(assoc-in % [:session :user-id] 42))) ; a function resp -> resp

If the parser has multiple responses with `augment-response` they will be applied
in order, the first one will receive an empty map as input. Only top level values
of your response will be checked for augmented response (i.e. primarily mutation responses).
sourceraw docstring

default-malformed-responseclj

The default response to return when a Transit request is malformed.

The default response to return when a Transit request is malformed.
sourceraw docstring

generate-responseclj

(generate-response
  {:keys [status body headers] :or {status 200} :as input-response})

Generate a Fulcro-compatible response containing at least a status code, headers, and body. You should pre-populate at least the body of the input-response. The content type of the returned response will always be pegged to 'application/transit+json'.

Generate a Fulcro-compatible response containing at least a status code, headers, and body. You should
pre-populate at least the body of the input-response.
The content type of the returned response will always be pegged to 'application/transit+json'.
sourceraw docstring

handle-api-requestclj

(handle-api-request query query-processor)

Given a parser and a query: Runs the parser on the query, and generates a standard Fulcro-compatible response.

Given a parser and a query: Runs the parser on the query,
and generates a standard Fulcro-compatible response.
sourceraw docstring

not-found-handlerclj

source

readerclj

(reader in)
(reader in opts)

Create a transit reader. This reader can handler the tempid type. Can pass transit reader customization opts map.

Create a transit reader. This reader can handler the tempid type.
Can pass transit reader customization opts map.
sourceraw docstring

wrap-apiclj

(wrap-api handler {:keys [uri parser]})

Wrap Fulcro API request processing. Required options are:

  • :uri - The URI on the server that handles the API requests.
  • :parser - A function (fn [eql-query] eql-response) that can process the query.

IMPORTANT: You must install wrap-transit-response and wrap-transit-params to your middleware below this.

Wrap Fulcro API request processing. Required options are:

- `:uri` - The URI on the server that handles the API requests.
- `:parser` - A function `(fn [eql-query] eql-response)` that can process the query.

IMPORTANT: You must install `wrap-transit-response` and `wrap-transit-params` to your middleware below this.
sourceraw docstring

wrap-transit-paramsclj

(wrap-transit-params handler)
(wrap-transit-params handler options)

Middleware that parses the body of Transit requests into a map of parameters, which are added to the request map on the :transit-params and :params keys. Accepts the following options: :malformed-response - a response map to return when the JSON is malformed :opts - a map of options to be passed to the transit reader Use the standard Ring middleware, ring.middleware.keyword-params, to convert the parameters into keywords.

Middleware that parses the body of Transit requests into a map of parameters,
which are added to the request map on the :transit-params and :params keys.
Accepts the following options:
:malformed-response - a response map to return when the JSON is malformed
:opts               - a map of options to be passed to the transit reader
Use the standard Ring middleware, ring.middleware.keyword-params, to
convert the parameters into keywords.
sourceraw docstring

wrap-transit-responseclj

(wrap-transit-response handler)
(wrap-transit-response handler options)

Middleware that converts responses with a map or a vector for a body into a Transit response. Accepts the following options: :encoding - one of #{:json :json-verbose :msgpack} :opts - a map of options to be passed to the transit writer

Middleware that converts responses with a map or a vector for a body into a
Transit response.
Accepts the following options:
:encoding - one of #{:json :json-verbose :msgpack}
:opts     - a map of options to be passed to the transit writer
sourceraw docstring

writerclj

(writer out)
(writer out opts)

Create a transit writer. This writer can handler the tempid type. Can pass transit writer customization opts map.

Create a transit writer. This writer can handler the tempid type.
Can pass transit writer customization opts map.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close