Defaults should work fine for most use cases:
(require '[ring.middleware.transit :refer [wrap-transit]])
(defn handler [request]
(let [username (get-in request [:params :username])]
{:hello username}))
(defn app
(-> handler
(wrap-transit)))
The handler above would accept transit requests and it would encode clojure data structures like maps and vectors into transit. See API documentation for more info.
wrap-transit
also accepts an options map, see API documentation for more info.
wrap-transit
is compatible with Aleph's deferred
responses. It should just work out of the box.