Skip to content

jlesquembre/pathom-pedestal

Repository files navigation

pathom-pedestal

Clojars Project cljdoc badge

A library to integrate pathom and pedestal

Usage

This library provide one main function, pathom-routes, which return a set of Pedestal routes, using the table syntax

(ns example.core
 (:require
   [io.pedestal.http :as http]
   [io.pedestal.http.route :as route]
   [pathom.pedestal :refer [pathom-routes]]))


(def routes
  (route/expand-routes (pathom-routes {:pathom-viz? true :parser parser})))

(defn create-server []
  (http/create-server
   {::http/routes routes
    ::http/type   :jetty
    ::http/port   8890}))

(http/start (create-server))

See API docs for a list of valid options

For convenience, a helper function, make-parser, is also provided.

Demo

See the example directory. To run it:

clj -A:demo

Go to http://localhost:8890/pathom and try some query. E.g.: [{[:tv-show/id :bcs] [:tv-show/title]}]

Development

For development, the demo can be used, but first is necessary to compile some dependencies, provided by pathom-viz:

git submodule update --init
make compile-viz  # Build web assets (with shadow-cljs)
clj -A:dev