Open sjatkins opened 8 years ago
Yes I would be interested in having an option for this too..in particular I see that boot-http
is already including ring handlers so maybe a simple patch would be to add the one that does CORS here?
@sjatkins can you post the link to the ring handler? Here is the link: https://github.com/r0man/ring-cors
An alternative would of course to be a custom handler as :handler
option
@sjatkins Quickest solution without adding any deps is to throw this somewhere and use it in the handler option.
(:require
[pandeiro.boot-http.impl :refer [dir-handler]]))
(defn asset-handler [req]
(-> req
((dir-handler {:dir "assets"}))
(assoc-in [:headers "Access-Control-Allow-Origin"] "*")))
I don't see an option here to do it although I do see one for ring servers. I would prefer to not use ring (mainly out of laziness and too much else to do). My situation is that I have a local http server at another point that I would like to access from clojurescript.
I am starting boot-http server like (server :reload true) so I am taking the defaults.