Minor update

This commit is contained in:
Yann Esposito (Yogsototh) 2024-03-05 18:00:23 +01:00
parent d33d4b3b35
commit 5ec587e25e
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
2 changed files with 17 additions and 4 deletions

View file

@ -11,6 +11,19 @@ Here is a CORS proxy implemented in very few lines of clojure.
lein run
```
Then in your js code
```js
// BEFORE
document.fetch(url) // => FAIL WITH CORS
// AFTER
document.fetch('http://127.0.0.1:1977/?url=' + encodeURIComponent(url)) // => WORKS
```
As simple as that.
## License
Copyright © 2024 Yann Esposito

View file

@ -1,5 +1,5 @@
(ns fuck-cors-app.core
(:require
(:require
[clj-http.client :as client]
[ring.adapter.jetty :as jetty]
[ring.middleware.params :refer [wrap-params]]
@ -13,10 +13,10 @@
:url url})))
(defn -main
[& args]
(jetty/run-jetty
[& _args]
(jetty/run-jetty
(-> handler
(wrap-params)
(wrap-open-cors))
(wrap-open-cors))
{:port 1977
:host "127.0.0.1"}))