Minor update
This commit is contained in:
parent
d33d4b3b35
commit
5ec587e25e
13
README.md
13
README.md
|
@ -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
|
||||
|
|
|
@ -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"}))
|
||||
|
|
Loading…
Reference in a new issue