yada

agigao 2018-08-23T13:06:59.000100Z

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.

agigao 2018-08-23T13:07:15.000100Z

(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})

dominicm 2018-08-23T15:15:09.000100Z

What's going wrong?

dominicm 2018-08-23T15:16:02.000100Z

Oh, you need to call (yada/handler (routes)) I think.

dominicm 2018-08-23T15:16:09.000100Z

When you start the server

agigao 2018-08-23T21:50:19.000100Z

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?