Fork me on GitHub

Hi! Does someone have example simple frontend-backend CRUD project with reitit? I cannot understand how to interact from frontend to backend rest api. May I just use simple http requests from frontend route handlers to bakend?


hi @alishermatkurbanov040, in the oficial repository has some examples there, have you looked at?


Reitit itself doesn't do much by itself, but it's a useful library to be used by other parts


A good chunk of our frontend init time is spent creating the router. We have a total of 130 routes and quite a few of them conflict since we have github-style routes /:profile-handle/:article-name which predate us switching to reitit. Is there a way to do this work ahead of time?


Oh wow. I was wondering if the performance trade offs reitit makes apply also to front end. Seems like the performance focus for frontend should rather be to amortize the cost over time, rather than at init time. Still, you have to somehow route at init too so not sure about ways to optimize this.


@mkvlr how many routes are you dealing with?


Looking at the code, the conflict resolution is run twice, should be easy win to fix that. Also, there doesn't seem to be a way to totally disable the conflict resolution, one could just use linear-router and get fast startup and bit slower routing.


If you define the router via def, shouldn't it be precalculated?


I could fix the two small things later today. The router creation is not perf optimized currently ..


I do have the router defined in a def


being able to specify the router implementation as an opt would go good for our use case I guess


seems it should be possible with the public api also, but I must have done something wrong when I tried


no rush at all btw, we’ve lived with this for a while, just recently discovered it and thought I’d ask


Hello all! I'm fairly new to clojure and reitit. I am trying to set up a ring/swagger service. Is there a way to have the default edn in both requests and responses? When I do a request now with accept = application/edn I still get a application/json response that must be decoded. E.g. {:status 200, :body #object[ 0x68a954f9 ""], :headers {"Content-Type" "application/json; charset=utf-8"}}.


@marcus.akre could you paste the request you are sending? if accept is edn, it should return it in that.


@mkvlr did a small spike on router creation perf. It’s crap 🙂 Here’s a PR for making it bit better:



(app {:request-method :get
    :uri "/plus"
      :query-params {:x 1 :y 2}}


:swagger {:produces #{"application/edn"}
                        :consumes #{"application/edn"}}


in the swagger ui the only option is edn


If I query with accept = edn it works fine. actually


(via http client that is)


@ikitommi thank you! Will give it a try tomorrow and let you know. Thanks again!