i’m trying to expose my whole API with CORS allowing any origin, but I can’t seem to find a sweet spot on how to accomplish this. I have a structure like so
(def routes-a ["" {:coercion rcs/coercion} ["/foo" {:middleware [custom-mw-stack-1]}]])
(def routes-b ["" {:coercion rcs/coercion} ["/bar" {:middleware [custom-mw-stack-2]}]])
(def app (ring/ring-handler (ring/router [routes-a routes-b])))
@benny Maybe something like that
(def app (ring/ring-handler
(ring/router
[routes-a routes-b]
{:data {:middleware [wrap-cors :access-control-allow-origin [#".*"]
:access-control-allow-methods [:get :put :post :patch :delete]]}})))
This is how I did in this project: https://github.com/prestancedesign/todo-backend-clojure-reitit/blob/master/src/todo_backend/core.clj#L65