https://github.com/duct-framework/client.http
A ClojureScript HTTP client for Duct
https://github.com/duct-framework/client.http
Last synced: 5 months ago
JSON representation
A ClojureScript HTTP client for Duct
- Host: GitHub
- URL: https://github.com/duct-framework/client.http
- Owner: duct-framework
- License: epl-1.0
- Created: 2025-08-06T03:03:31.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2025-08-06T03:58:16.000Z (5 months ago)
- Last Synced: 2025-08-06T05:31:36.970Z (5 months ago)
- Language: Clojure
- Size: 7.81 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Duct HTTP client
A simple ClojureScript HTTP client for the [Duct][] framework. It wraps
[cljs-http][] and is designed to talk to a Duct webserver via
[Transit][] over JSON.
[duct]: https://github.com/duct-framework/duct
[cljs-http]: https://github.com/r0man/cljs-http
[transit]: https://github.com/cognitect/transit-clj
## Installation
Add the following dependency to your deps.edn file:
org.duct-framework/client.http {:mvn/version "0.1.0"}
Or to your Leiningen project file:
[org.duct-framework/client.http "0.1.0"]
## Usage
This library provides functions for the main HTTP methods: `get`, `post`,
`put`, `patch` and `delete`.
```clojurescript
(ns example.client
(:require [duct.client.http :as http]))
;; get data from the server via a string URL
(http/get "/user/1")
;; ...or with vector format for URLs
(http/get [:user 1])
;; query parameters can also be added
(http/get [:user :search] {:q "alice"})
```
The vector format turns each element into a string, then separates
them by a slash. A starting slash is added if missing.
The value returned is a core.async channel, so to get the result you
will need a go block.
```clojurescript
(ns example.client
(:require [clojure.core.async :refer [(