Skip to content
Permalink
Browse files

json support

  • Loading branch information...
pjagielski committed Sep 14, 2015
1 parent 80d77a4 commit c15f3c51855034a1c8f8431171134f6719cadffe
Showing with 21 additions and 2 deletions.
  1. +6 −0 .gitignore
  2. +3 −0 dev/local.clj
  3. +4 −0 profiles.clj
  4. +3 −1 project.clj
  5. +2 −1 src/modern_clj_web/endpoint/example.clj
  6. +3 −0 src/modern_clj_web/system.clj
@@ -0,0 +1,6 @@
.nrepl-port
/target/
.lein*
config.edn
.idea
*.iml
@@ -0,0 +1,3 @@
;; Local REPL configuration

(alter-var-root #'config meta-merge {})
@@ -0,0 +1,4 @@
;; Local profile overrides

{:profiles/dev {:env {}}
:profiles/test {}}
@@ -10,7 +10,9 @@
[meta-merge "0.1.1"]
[ring "1.4.0"]
[ring/ring-defaults "0.1.5"]
[ring-jetty-component "0.2.2"]]
[ring-jetty-component "0.2.2"]
[ring/ring-json "0.3.1"]
[cheshire "5.1.1"]]
:plugins [[lein-environ "1.0.0"]
[lein-gen "0.2.2"]]
:generators [[duct/generators "0.3.0"]]
@@ -1,7 +1,8 @@
(ns modern-clj-web.endpoint.example
(:require [compojure.core :refer :all]
[clojure.java.io :as io]))
[ring.util.response :refer [response]]))

(defn example-endpoint [config]
(routes
(GET "/hello" [] (response {:hello "world"}))
(GET "/" [] "Hello World")))
@@ -6,10 +6,13 @@
[meta-merge.core :refer [meta-merge]]
[ring.component.jetty :refer [jetty-server]]
[ring.middleware.defaults :refer [wrap-defaults api-defaults]]
[ring.middleware.json :refer [wrap-json-body wrap-json-response]]
[modern-clj-web.endpoint.example :refer [example-endpoint]]))

(def base-config
{:app {:middleware [[wrap-not-found :not-found]
[wrap-json-body {:keywords? true}]
[wrap-json-response]
[wrap-defaults :defaults]]
:not-found "Resource Not Found"
:defaults (meta-merge api-defaults {})}})

0 comments on commit c15f3c5

Please sign in to comment.
You can’t perform that action at this time.