Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update routes and docs.

  • Loading branch information...
commit 4fd949ce8dba63be5b7044979917fa26a03fde97 1 parent 6d226f5
@dakrone authored
View
4 README.markdown
@@ -13,6 +13,7 @@ Getting examples
----------------
curl "http://localhost:8080/examples/clojure.core/map"
+ curl "http://localhost:8080/examples/1.2.0/clojure.core/map"
Searching for a function
------------------------
@@ -24,6 +25,7 @@ Searching for comments on a function
------------------------------------
curl "http://localhost:8080/comments/clojure.contrib.json/read-json"
+ curl "http://localhost:8080/comments/1.2.0/clojure.contrib.json/read-json"
Getting the 'see-also' functions
--------------------------------
@@ -34,6 +36,8 @@ Getting the available versions clojuredocs knows about
------------------------------------------------------
curl "http://localhost:8080/versions"
+ curl "http://localhost:8080/versions/clojure.core"
+ curl "http://localhost:8080/versions/clojure.core/map"
License
-------
View
2  project.clj
@@ -1,4 +1,4 @@
-(defproject cd-wsapi "0.1.0"
+(defproject cd-wsapi "0.2.0"
:description "ClojureDocs External API"
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]
View
41 resources/index.html
@@ -10,40 +10,37 @@
All API functions return JSON.
-<h2>Usage:</h2>
+<h2>Usage</h2>
<h3>Getting examples</h3>
-<pre>
-<code>
- curl "http://api.clojuredocs.org/examples/clojure.core/map"
-</code>
-</pre>
+<pre><code>curl "http://api.clojuredocs.org/examples/clojure.core/map"
+curl "http://api.clojuredocs.org/examples/1.2.0/clojure.core/map"
+</code></pre>
<h3>Searching for a function</h3>
-<pre>
-<code>
- curl "http://api.clojuredocs.org/search/map"
- curl "http://api.clojuredocs.org/search/clojure.core/map"
-</code>
-</pre>
+<pre><code>curl "http://api.clojuredocs.org/search/map"
+curl "http://api.clojuredocs.org/search/clojure.core/map"
+</code></pre>
<h3>Searching for comments on a function</h3>
-<pre>
-<code>
- curl "http://api.clojuredocs.org/comments/clojure.contrib.json/read-json"
-</code>
-</pre>
+<pre><code>curl "http://api.clojuredocs.org/comments/clojure.contrib.json/read-json"
+curl "http://api.clojuredocs.org/comments/1.2.0/clojure.contrib.json/read-json"
+</code></pre>
<h3>Getting the 'see-also' functions</h3>
-<pre>
-<code>
- curl "http://api.clojuredocs.org/see-also/clojure.test/are"
-</code>
-</pre>
+<pre><code>curl "http://api.clojuredocs.org/see-also/clojure.test/are"
+</code></pre>
+
+<h3>Getting the available versions clojuredocs knows about</h3>
+
+<pre><code>curl "http://api.clojuredocs.org/versions"
+curl "http://api.clojuredocs.org/versions/clojure.core"
+curl "http://api.clojuredocs.org/versions/clojure.core/map"
+</code></pre>
Or check out a <a href="http://github.com/dakrone/cd-client">tiny client</a> for getting Clojure datastructures from the API.
<br />
<br />
View
26 src/cd_wsapi/core.clj
@@ -195,18 +195,20 @@
(defn app-handler [channel request]
(enqueue-and-close
- channel
- ((app
- ["examples" ns name] (examples ns name)
- ["search" ns name] (search ns name)
- ["search" name] (search name)
- ["comments" ns name] (get-comments ns name)
- ["see-also" ns name] (see-also ns name)
- ["versions"] (available-versions)
- ["versions" ns] (available-versions ns)
- ["versions" ns name] (available-versions ns name)
- [&] default)
- request)))
+ channel
+ ((app
+ ["examples" ns name] (examples ns name)
+ ["examples" version ns name] (examples ns name version)
+ ["search" ns name] (search ns name)
+ ["search" name] (search name)
+ ["comments" ns name] (get-comments ns name)
+ ["comments" version ns name] (get-comments ns name version)
+ ["see-also" ns name] (see-also ns name)
+ ["versions"] (available-versions)
+ ["versions" ns] (available-versions ns)
+ ["versions" ns name] (available-versions ns name)
+ [&] default)
+ request)))
(defn app-wrapper [channel request]
Please sign in to comment.
Something went wrong with that request. Please try again.