Skip to content

Instantly share code, notes, and snippets.

@ryancole
Created March 30, 2015 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryancole/c4fd8222818e6fa64b7a to your computer and use it in GitHub Desktop.
Save ryancole/c4fd8222818e6fa64b7a to your computer and use it in GitHub Desktop.
(ns replays.handler
(:require [compojure.core :refer [GET defroutes]]
[compojure.route :as route]
[ring.util.response :refer [response resource-response]]
[ring.middleware.json :as json]
[ring.middleware.defaults :refer [wrap-defaults api-defaults]]))
(defroutes app-routes
(GET "/" [] (resource-response "index.html" {:root "public"}))
(GET "/widgets" [] (response [{:name "Widget 1"} {:name "Widget 2"}]))
(route/resources "/public")
(route/not-found "not found"))
(def app
(-> app-routes
(json/wrap-json-body)
(json/wrap-json-response)
(wrap-defaults api-defaults)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment