mirror of
https://github.com/penpot/penpot.git
synced 2025-08-03 17:18:21 +02:00
Initial commit
This commit is contained in:
commit
2a32f1fcf6
181 changed files with 24339 additions and 0 deletions
41
backend/uxbox/router.clj
Normal file
41
backend/uxbox/router.clj
Normal 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))
|
Loading…
Add table
Add a link
Reference in a new issue