This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-23
Channels
- # announcements (12)
- # beginners (225)
- # calva (7)
- # cider (45)
- # clj-kondo (1)
- # cljdoc (1)
- # cljsrn (3)
- # clojure (112)
- # clojure-dev (45)
- # clojure-europe (6)
- # clojure-finland (2)
- # clojure-india (1)
- # clojure-nl (27)
- # clojure-spec (37)
- # clojure-uk (171)
- # clojurescript (39)
- # core-async (9)
- # cursive (22)
- # datascript (8)
- # datomic (50)
- # emacs (12)
- # figwheel-main (17)
- # fulcro (42)
- # garden (2)
- # hoplon (27)
- # jobs (4)
- # kaocha (8)
- # klipse (2)
- # luminus (2)
- # off-topic (9)
- # perun (33)
- # planck (2)
- # re-frame (9)
- # reagent (48)
- # reitit (5)
- # remote-jobs (1)
- # rum (2)
- # shadow-cljs (23)
- # slack-help (3)
- # spacemacs (18)
- # sql (7)
- # tools-deps (24)
- # unrepl (9)
- # vim (30)
@scot-brown yes, it's identical to compojure.core/routes
. But it's not intended to be used inside of the reitit route tree, but to help combine routes in the default-routes branch.
hi reitit. i'm writing a web api using reitit that returns a very large response. how do i go about zipping it up. i've tried adding https://github.com/clj-commons/ring-gzip-middleware to the list of middleware but it doesn't seem to affect the response time:
{;;:reitit.middleware/transform dev/print-request-diffs
:data {:coercion reitit.coercion.spec/coercion
:muuntaja m/instance
:middleware [;; query-params & form-params
parameters/parameters-middleware
;; content-negotiation
muuntaja/format-negotiate-middleware
;; encoding response body
muuntaja/format-response-middleware
;; exception handling
exception/exception-middleware
;; decoding request body
muuntaja/format-request-middleware
;; coercing response bodies
coercion/coerce-response-middleware
;; coercing request parameters
coercion/coerce-request-middleware
;; gziping
ring-gzip/wrap-gzip
]}}
@ben.mumford620 response time? does it effect the response size? I think you should put that on top of the chain, so that it’s the last thing what happens. now it’s the first thing that happens after a handler returns (and things like response coercion doesn’t work as they can’t see inside the zip)
thanks i'll give it a go
if you need it just for one route, you do something like:
["/large"
{:middleware ^:prepend [ring-gzip/wrap-gzip]
:handler ...}]
, and it will be added as first in the list. Thanks to awesome merge-hints of meta-merge (https://github.com/weavejester/meta-merge#metadata)