Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jlesquembre/pathom-pedestal
Pedestal helpers for Pathom
https://github.com/jlesquembre/pathom-pedestal
clojure html pedestal
Last synced: 3 months 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 (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-07T05:12:40.000Z (over 4 years ago)
- Last Synced: 2024-07-25T19:26:57.312Z (7 months ago)
- Topics: clojure, html, pedestal
- Language: CSS
- Size: 1.29 MB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# pathom-pedestal
[![Clojars Project](https://img.shields.io/clojars/v/lafuente/pathom-pedestal.svg)](https://clojars.org/lafuente/pathom-pedestal)
[![cljdoc badge](https://cljdoc.org/badge/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 optionsFor 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
```