diff options
author | David Barksdale <amatus@amat.us> | 2017-04-22 14:24:30 -0500 |
---|---|---|
committer | David Barksdale <amatus@amat.us> | 2017-04-22 14:24:30 -0500 |
commit | 1ba2f3e437281adef7b9ffdd724a13eb78a1d3a3 (patch) | |
tree | 703244c4d2369eee2ebf72c2a2c933480a6195ed /src | |
parent | d95b38575fe6157cf000747cc1b4da9e33d3d9cd (diff) |
Add state-fn
Diffstat (limited to 'src')
-rw-r--r-- | src/app/api.clj | 4 | ||||
-rw-r--r-- | src/app/handler.clj | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/app/api.clj b/src/app/api.clj index 0f7ab17..f3a4324 100644 --- a/src/app/api.clj +++ b/src/app/api.clj @@ -1,6 +1,4 @@ (ns app.api (:require [castra.core :refer [defrpc]])) -(defrpc get-state [] - {:inputs [] - :outputs []}) +(defrpc get-state []) diff --git a/src/app/handler.clj b/src/app/handler.clj index fdf722e..21d52ab 100644 --- a/src/app/handler.clj +++ b/src/app/handler.clj @@ -12,9 +12,13 @@ (c/GET "/" req (response/content-type (response/resource-response "index.html") "text/html")) (route/resources "/" {:root ""})) +(defn state-fn [] + {:temps @temp/temp + :pm (select-keys @pm/pm [:status :current])}) + (def app (-> app-routes - (castra/wrap-castra {:state-fn (fn [] "ohi")} 'app.api) + (castra/wrap-castra {:state-fn state-fn} 'app.api) (d/wrap-defaults d/api-defaults))) (db/init) |