Skip to content

Instantly share code, notes, and snippets.

@laser
Last active August 29, 2015 14:11
Show Gist options
  • Save laser/f4bc6421b79bc47b05d2 to your computer and use it in GitHub Desktop.
Save laser/f4bc6421b79bc47b05d2 to your computer and use it in GitHub Desktop.
Adding JSON middleware
(ns pipeline.core
(:require [compojure.core :refer [POST defroutes]]
[ring.middleware.json :refer [wrap-json-response wrap-json-body]]
[ring.util.response :refer [response]])
(:gen-class))
(defn post-notes-handler
[req-body]
(response req-body))
(defroutes router
(POST "/notes" {req-body :body} (post-notes-handler req-body)))
(def app
(-> router
wrap-json-body
(wrap-json-response {:keywords? true})))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment