https://github.com/jlesquembre/pathom-pedestal
Pedestal helpers for Pathom
https://github.com/jlesquembre/pathom-pedestal
clojure html pedestal
Last synced: about 1 year ago
JSON representation
Pedestal helpers for Pathom
- Host: GitHub
- URL: https://github.com/jlesquembre/pathom-pedestal
- Owner: jlesquembre
- License: epl-1.0
- Created: 2018-07-17T16:38:09.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-07-07T05:12:40.000Z (about 6 years ago)
- Last Synced: 2025-03-30T21:15:06.952Z (over 1 year ago)
- Topics: clojure, html, pedestal
- Language: CSS
- Size: 1.29 MB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# pathom-pedestal
[](https://clojars.org/lafuente/pathom-pedestal)
[](https://cljdoc.org/d/lafuente/pathom-pedestal/CURRENT)
A library to integrate [pathom](https://github.com/wilkerlucio/pathom) and
[pedestal](http://pedestal.io/)
## Usage
This library provide one main function, `pathom-routes`, which return a set of
[Pedestal routes](http://pedestal.io/reference/routing-quick-reference), using
the
[table syntax](http://pedestal.io/reference/routing-quick-reference#_table_syntax)
```clojure
(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](https://cljdoc.org/d/lafuente/pathom-pedestal/CURRENT/api/pathom.pedestal#pathom-routes)
for a list of valid options
For convenience, a helper function, `make-parser`, is also provided.
## Demo
See the example directory. To run it:
```bash
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](https://github.com/wilkerlucio/pathom-viz):
```bash
git submodule update --init
make compile-viz # Build web assets (with shadow-cljs)
clj -A:dev
```