Skip to content

Instantly share code, notes, and snippets.

@noisesmith
Forked from tdreyno/gist:6502823
Last active December 22, 2015 16:59
Show Gist options
  • Save noisesmith/6502843 to your computer and use it in GitHub Desktop.
Save noisesmith/6502843 to your computer and use it in GitHub Desktop.
(defn home-api-map
[]
{ :banner (model/pick :banner {:where {:slug "home"}})
:intro-headline (model/pick :headline {:where {:slug "intro"}})
:intro-slides (model/gather :slides {:where {:slug "intro"} :include {:slides {}}})
:intro-highlights (model/gather :highlight {:where {:slug "intro"}})
:tenants (model/gather :tenant)
:partners (model/gather :neighborhood-partner)
:whats-here-headline (model/pick :headline {:where {:slug "whats-here"}})
:project-highlights (model/gather :project-highlights {:include {:highlights {}}})
:contact-headline (model/pick :headline {:where {:slug "contact"}})
:leasing (model/pick :leasing-info {:include {:contacts {}}}) })
(defn home-api-response
[]
{ :status 200
:headers { "Content-Type" "application/json" }
:body (cheshire/generate-string { :response (home-api-map) }) })
(def cached-home-api-response
; Cache for an hour
(timed/cached home-api-response (* 1000 60 60)))
(defn home-json-api
[request]
(cached-home-api-response))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment