A small example of using async batches to resolve GraphQL fields in Clojure using lacinia and grouper.
If you don't have Docker CE installed, you can download it here.
Once Docker is installed, you can move to Usage with Docker.
Make sure Clojure is installed. On MacOS, for example: brew install clojure
.
Next, setup a running PostgreSQL instance:
brew install postgresql
brew services start postgresql
Create the example database:
createdb graphql_batching
$ docker-compose run main
Start the REPL like so
$ docker-compose run --service-ports main -A:dev:examples
Once it's up, require and enter the schema namspace:
(require '[postgres.core :as pg])
; default-db can be replaced with a connection string/object
(pg/reset-example pg/default-db)
(pg/run-example pg/default-db)
$ export DATABASE_URL="<my-postgresql-database-string>"
$ clj -A:examples -e "(require 'postgres.core)(postgres.core/-main)"
Run clj -A:dev:examples
in the source directory.
Once it's up, require and enter the schema namspace:
(require '[postgres.core :as pg])
; default-db can be replaced with a connection string/object
(pg/reset-example pg/default-db)
(pg/run-example pg/default-db)