Add HTTP docs
This commit is contained in:
parent
92e5c4a432
commit
94559f7626
1 changed files with 26 additions and 0 deletions
26
README.md
26
README.md
|
|
@ -622,6 +622,32 @@ bb '
|
||||||
process 2
|
process 2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## HTTP
|
||||||
|
|
||||||
|
For making HTTP requests you can use:
|
||||||
|
|
||||||
|
- `slurp` for simple `GET` requests
|
||||||
|
- [clj-http-lite](https://github.com/borkdude/clj-http-lite) as a library
|
||||||
|
- `curl` via `clojure.java.shell`. For an example, see the following
|
||||||
|
subsection.
|
||||||
|
|
||||||
|
### HTTP over Unix sockets
|
||||||
|
|
||||||
|
This can be useful for talking to Docker:
|
||||||
|
|
||||||
|
``` clojure
|
||||||
|
(require '[clojure.java.shell :refer [sh]])
|
||||||
|
(require '[cheshire.core :as json])
|
||||||
|
(-> (sh "curl" "--silent"
|
||||||
|
"--no-buffer" "--unix-socket"
|
||||||
|
"/var/run/docker.sock"
|
||||||
|
"http://localhost/images/json")
|
||||||
|
:out
|
||||||
|
(json/parse-string true)
|
||||||
|
first
|
||||||
|
:RepoTags) ;;=> ["borkdude/babashka:latest"]
|
||||||
|
```
|
||||||
|
|
||||||
## Differences with Clojure
|
## Differences with Clojure
|
||||||
|
|
||||||
Babashka is implemented using the [Small Clojure
|
Babashka is implemented using the [Small Clojure
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue