reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
2020-09-13T19:39:55.110500Z

Hello. Just getting acquainted with reitit, and am wondering what is the state of CORS support in Reitit... Found on the web problems with ring CORS middleware, so are there some news on this, and if there's still no official Reitit support for this, how do people handling it in the mean time?

dharrigan 2020-09-13T19:44:45.110700Z

I roll my own, i.e.,

dharrigan 2020-09-13T19:45:00.111Z

(ring/router
   [["/api"
     ["/ping" {:get {:handler pong}}]
     ["/foo"
      ["" {:options {:handler cors-handler}
...
...

dharrigan 2020-09-13T19:45:17.111200Z

(def cors {"Access-Control-Allow-Origin" "*"
           "Access-Control-Allow-Headers" "Origin, Accept, Access-Control-Request-Method, Access-Control-Allow-Headers, Content-Type, *"})

dharrigan 2020-09-13T19:45:27.111400Z

(defn cors-handler
  [_]
  {:headers cors :status ok})

dharrigan 2020-09-13T19:45:30.111600Z

works for me 🙂

dharrigan 2020-09-13T19:45:54.112Z

others may have different approaches 🙂

2020-09-13T19:47:03.112200Z

ok ,thanx

dharrigan 2020-09-13T19:47:17.112500Z

np. It's super simple to do it yourself 🙂

dharrigan 2020-09-13T19:47:19.112700Z

ttfn! 🙂