This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-08
Channels
- # aleph (4)
- # beginners (5)
- # cljs-dev (21)
- # clojure (155)
- # clojure-dev (3)
- # clojure-italy (10)
- # clojure-losangeles (3)
- # clojure-nl (2)
- # clojure-russia (5)
- # clojure-spec (42)
- # clojure-uk (11)
- # clojurescript (170)
- # code-art (1)
- # component (3)
- # core-async (28)
- # cursive (70)
- # data-science (3)
- # datascript (1)
- # datomic (28)
- # emacs (6)
- # gorilla (1)
- # graphql (2)
- # jobs (1)
- # lein-figwheel (4)
- # lumo (7)
- # off-topic (13)
- # om (63)
- # parinfer (66)
- # planck (1)
- # re-frame (22)
- # reagent (2)
- # ring-swagger (53)
- # rum (3)
- # sql (13)
- # test-check (2)
- # unrepl (48)
- # vim (8)
- # yada (33)
Yep, well, POSIX sed is even suckier - there’s no -i
option at all (so it’s explicit redirection and renaming)
Any recommendations on where to register a custom transit writer with yada? (for yoda time dates)
Register a new media type?
Afk. But all media types are registered with defmethod. Git grep defmethod you should find some.
Hello I'm trying to understand the yada/bidi/ring relation, I'm getting a table with a :handler topkey which I think is the ring handler that goes through a ring-compatible server
I'm going through the transformations in this sequence: yada/resource -> bidi/match-route -> yada/handler
(ring req) (ring req) (yada ctx)
Aleph ----> Bidi ------> Yada Handler ------> Yada resource
I created the handler based on the resource return so I could attach to the handler, but it looks like I had it flipped =P
thanks
oh yeah, my mistake the code looks like yours but the bidi method comes first
(defn handler [{:keys [uri]}]
(println uri)
(yada/handler (bidi/match-route route uri)))
the route returns a yada/resource like this
(def route ["/" {"" (layout main-page) ...
(defn layout [content]
(yada/resource
{:access-control
{:realm "account"
:scheme "basic"
:verify (fn [ctx] (println ctx))}
:methods
{:get
...
(defn handler [{:keys [uri] :as req}]
((yada/handler (bidi/match-route route uri)) req))
Try thisIt's also worth noting that if you pass a vector to yada/handler
, it will create a bidi router for you & such.
so I don't need bidi/match-route right?
If you haven't got a pre-existing project for this, it's a little easier to use edge https://github.com/juxt/edge Others have bootstrapped from it.
I don't get in this example what server is running... I'm trying to run aleph with the return of the yada/handler as the handler. but in this example there's a vhost usecase
@dominicm and that's essentially the issue, how my handler is being handled by aleph is not correctly working I assume
that's the system that I'm using from system.components
(defsystem dev-system
[:db (new-datomic-db (env :db-uri))
:web (component/using
(new-web-server (read-string (env :http-port))
handler)
[:db])])
(:require [system.core :refer [defsystem]]
(system.components
[aleph :refer [new-web-server]]
[datomic :refer [new-datomic-db]])
https://github.com/juxt/yada/blob/02f886c779adba5df98cb217ea3a9ae4955fa0e8/ext/aleph/src/yada/aleph.clj make sure to set :raw-stream?
if you're using aleph raw
https://github.com/juxt/yada/blob/02f886c779adba5df98cb217ea3a9ae4955fa0e8/ext/aleph/src/yada/aleph.clj#L15 you can call as-handler
on the routes
@vinnyataide https://github.com/juxt/edge/blob/41e16fff5cc05da00500aabdcf9331499280c171/src/edge/web_server.clj#L109-L125 example component
all right