Hi there, I’ve been playing with yada lately and decided to go “simple” route, build on my own instead of using edge. So, right now have: - db connection(postgresql) - resource defined - route created and trying to fire-up aleph server, which I’m having tough time to achieve.
(ns va-api.core
(:require [va-api.db :refer [db]]
[va-api.sql :as sql]
[yada.yada :as yada]
[aleph.http :as http]
[clojure.pprint :as pprint])
(:gen-class))
(def index-resource
(yada/resource
{:produces {:media-type "text/plain"}
:methods {:get
{:response (sql/get-persons db)}
}}))
(defn routes [_]
["/" (yada/handler index-resource)])
(http/start-server routes {:port 8080})
What's going wrong?
Oh, you need to call (yada/handler (routes))
I think.
When you start the server
Well, I tried and received a yada page with methods, interceptor-chain etc.
But (http/start-server (yada/handler index-resource) {:port 8080})
works fine.
Another but: how can I bind multiple routes to a single yada handler?