Initial commit

This commit is contained in:
Andrey Antukh 2015-06-18 19:35:50 +02:00
commit 2a32f1fcf6
181 changed files with 24339 additions and 0 deletions

41
backend/uxbox/router.clj Normal file
View file

@ -0,0 +1,41 @@
(ns uxbox.router
(:refer-clojure :exclude [error-handler])
(:require [uxbox.impl.routing :as rt]
[com.stuartsierra.component :as component]
[catacumba.components :refer (catacumba-server assoc-routes!)]
[cats.core :as m]
[promissum.core :as p]))
(defmulti handler
(fn [context frame]
[(:cmd frame)
(:dest frame)]))
;; (defmethod handler [:novelty :auth]
;; [context frame]
;; (let [state (:state context)
;; body (:body frame)]
;; (m/mlet [user (authenticate body)]
;; (swap! state assoc :user user)
;; (m/return (rt/response {:ok true})))))
;; (defmethod handler [:query :project]
;; [context frame]
;; (let [state (:state context)
;; body (:body frame)]
;; (m/mlet [proj (query-project body)]
;; (m/return (rt/response proj)))))
(defrecord WebComponent [config server]
component/Lifecycle
(start [this]
(let [routes [[:any "api" (rt/router handler)]]]
(assoc-routes! server ::web routes)))
(stop [this]
;; noop
))
(defn component
[]
(WebComponent. nil nil))