Skip to content

Instantly share code, notes, and snippets.

@aeriksson
Created June 9, 2015 10:42
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 aeriksson/072546aafcaee64c6db6 to your computer and use it in GitHub Desktop.
Save aeriksson/072546aafcaee64c6db6 to your computer and use it in GitHub Desktop.
;; This gives "Can't use qualified name as parameter: id"
;; Note that defresource is a macro: https://clojure-liberator.github.io/liberator/doc/resource-definition.html
(defmacro def-get-resource [name exists-fn get-fn]
`(defresource ~name [id]
:available-media-types ["application/json"]
:exists? (~exists-fn id)
:handle-ok (~get-fn id)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment