Skip to content

Commit

Permalink
Add readme to root page of the API.
Browse files Browse the repository at this point in the history
  • Loading branch information
dakrone committed Sep 8, 2010
1 parent f7ef7e8 commit a7dafec
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
49 changes: 49 additions & 0 deletions resources/index.html
Original file line number Diff line number Diff line change
@@ -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>
5 changes: 3 additions & 2 deletions src/cd_wsapi/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[org.danlarkin.json]))

(def *server-port* 8080)
(def *default-page* (slurp "resources/index.html"))

;;JSON Encoders
(add-encoder
Expand All @@ -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
Expand Down

0 comments on commit a7dafec

Please sign in to comment.