Liking cljdoc? Tell your friends :D

pinkgorilla.middleware


allow-cross-originclj

(allow-cross-origin handler)
(allow-cross-origin handler allowed-origins)

Middleware function to allow cross origin requests from browsers. When a browser attempts to call an API from a different domain, it makes an OPTIONS request first to see the server's cross origin policy. So, in this method we return that when an OPTIONs request is made. Additionally, for non OPTIONS requests, we need to just return the 'Access-Control-Allow-Origin' header or else the browser won't read the data properly. The above notes are all based on how Chrome works.

Middleware function to allow cross origin requests from browsers.
When a browser attempts to call an API from a different domain, it makes an OPTIONS request first to see the server's
cross origin policy.  So, in this method we return that when an OPTIONs request is made.
Additionally, for non OPTIONS requests, we need to just return the 'Access-Control-Allow-Origin' header or else
the browser won't read the data properly.
The above notes are all based on how Chrome works. 
sourceraw docstring

wrap-baseclj

(wrap-base handler)
source

wrap-middlewareclj

(wrap-middleware handler)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close