Skip to content

Instantly share code, notes, and snippets.

@fasiha
Last active March 30, 2016 02:31
Embed
What would you like to do?
(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