https://github.com/r0man/request-clj
A HTTP library for Clojure & ClojureScript.
https://github.com/r0man/request-clj
Last synced: 9 months ago
JSON representation
A HTTP library for Clojure & ClojureScript.
- Host: GitHub
- URL: https://github.com/r0man/request-clj
- Owner: r0man
- Created: 2013-08-11T19:31:59.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-01-05T20:42:49.000Z (about 9 years ago)
- Last Synced: 2025-03-23T20:43:33.208Z (10 months ago)
- Language: Clojure
- Size: 113 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
#+title: request-clj
#+author: roman
#+LANGUAGE: en
[[https://travis-ci.org/r0man/request-clj][https://travis-ci.org/r0man/request-clj.svg]]
[[http://jarkeeper.com/r0man/request-clj][http://jarkeeper.com/r0man/request-clj/status.svg]]
[[http://jarkeeper.com/r0man/request-clj][http://jarkeeper.com/r0man/request-clj/downloads.svg]]
* Installation
[[https://clojars.org/request-clj][https://clojars.org/request-clj/latest-version.svg]]
* Usage
Require the library.
#+BEGIN_SRC clojure :exports code :results silent
(require '[request.core :refer [defroutes] :as routes])
#+END_SRC
Define routes by passing vectors of route pattern and route names do
=defroutes=.
#+BEGIN_SRC clojure :exports code :results silent
(defroutes my-routes
["/countries" :countries]
["/countries/:id" :country]
["/spots" :spots]
["/spots/:id" :spot])
#+END_SRC
Make an HTTP client.
#+BEGIN_SRC clojure :exports code :results silent
(def client
(routes/new-client
{:scheme :https
:server-name "example.com"}))
#+END_SRC
Make an HTTP using a route.
#+BEGIN_SRC clojure :exports both :results verbatim
(routes/get client :country {:id 1 :name "Spain"})
#+END_SRC
* License
Copyright © 2012-2015 r0man
Distributed under the Eclipse Public License, the same as Clojure.