Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'develop'

  • Loading branch information...
commit 7688bac326521151082c1d00a139f96a3b995ac8 2 parents 6bc2788 + a7dafec
@dakrone dakrone authored
Showing with 52 additions and 2 deletions.
  1. +49 −0 resources/index.html
  2. +3 −2 src/cd_wsapi/core.clj
View
49 resources/index.html
@@ -0,0 +1,49 @@
+<html>
+ <head>
+ <title>ClojureDocs Web API</title>
+</head>
+<body>
+<br />
+<br />
+ <div id='main' style='border: 3px double; width: 600px; margin-left: auto; margin-right: auto; padding-left: 15px;'>
+<h1>ClojureDocs.org web API</h1>
+
+All API functions return JSON.
+
+<h2>Usage:</h2>
+
+<h3>Getting examples</h3>
+
+<pre>
+<code>
+ curl "http://api.clojuredocs.org/examples/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>
+
+<h3>Searching for comments on a function</h3>
+
+<pre>
+<code>
+ curl "http://api.clojuredocs.org/comments/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>
+ </div>
+</body>
+</html>
View
5 src/cd_wsapi/core.clj
@@ -5,6 +5,7 @@
[org.danlarkin.json]))
(def *server-port* 8080)
+(def *default-page* (slurp "resources/index.html"))
;;JSON Encoders
(add-encoder
@@ -25,8 +26,8 @@
(defn default [request]
{:status 200
- :headers {"Content-Type" "application/json"}
- :body "null"})
+ :headers {"Content-Type" "text/html"}
+ :body *default-page*})
(defn get-id
Please sign in to comment.
Something went wrong with that request. Please try again.