Skip to content

Instantly share code, notes, and snippets.

@fasiha
Last active March 30, 2016 02:31
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 fasiha/378e53152a9162da80c6a10ff1d4ade8 to your computer and use it in GitHub Desktop.
Save fasiha/378e53152a9162da80c6a10ff1d4ade8 to your computer and use it in GitHub Desktop.
(ns …
(:require [compojure.core :refer [GET POST defroutes]]
; …
[ring.middleware.format :refer [wrap-restful-format]] ; see https://github.com/ngrunwald/ring-middleware-format
))
(defroutes handler
(POST
"/url"
req
(let [params (:params req)]
{:body (foo params)})) ; `(foo params)` will be Transit-encoded! But NOTE! return value must be map with :body slot!
…)
(def app (-> #'handler
; …
(wrap-restful-format)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment