         repos (j/parse-string (:body response) true)]
     repos))
 
+(defn get-apps [req]
+  {:status 200
+   :body (j/encode {"apps1" {:id "123"}
+                    "apps2" {:id "234"}})})
+
 (defn create-app [req]
   (let [app-name (get-in req [:route-params :app])
         token (get-in req [:params :token])

  (friend/logout (ANY "/logout" request (ring.util.response/redirect "/"))))

(defroutes routes
  (GET "/" [] (pages/index))
  (GET "/_ping"  [] ping)
  (context "/users" req users-routes)
  (context "/apps/:app" req apps-routes)
  (resources "/")
  (not-found "404 Not Found"))


(defn ping [req]
  {:status 200})

(defn index [req]
  (if (friend/authorized? [:user] req)
    (pages/index)
    "<a href=\"/oauth/github\">Login By GitHub</a>"))

(defroutes apps-routes
  (GET    "/" req (get-apps req))
  (GET    "/:app/logs" req (logs req))
  (POST   "/:app" req (create-app req))
  (PUT    "/:app" req (update-app req))
  (DELETE "/:app" req (delete-app req)))

(defroutes users-routes
  (GET "/" request "<a href=\"/users/repos\">My Github Repositories</a><br><a href=\"/users/status\">Status</a>")
