Skip to content

Commit 0aaf44a

Browse files
Michael Zavarellaleebyron
authored andcommitted
Added Alumbra and Lacinia to the clojure section (graphql#291)
1 parent a9a54f5 commit 0aaf44a

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

site/code/index.html.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,45 @@ See [the graphql-java docs](https://github.com/graphql-java/graphql-java) for mo
260260
261261
### Clojure
262262
263+
#### [alumbra](https://github.com/alumbra/alumbra)
264+
265+
A set of reuasable GraphQL components for Clojure conforming to the data structures given in [alumbra.spec](https://github.com/alumbra/alumbra.spec).
266+
267+
\`\`\`clojure
268+
(require '[alumbra.core :as alumbra]
269+
'[claro.data :as data])
270+
271+
(def schema
272+
"type Person { name: String!, friends: [Person!]! }
273+
type QueryRoot { person(id: ID!): Person, me: Person! }
274+
schema { query: QueryRoot }")
275+
276+
(defrecord Person [id]
277+
data/Resolvable
278+
(resolve! [_ _]
279+
{:name (str "Person #" id)
280+
:friends (map ->Person (range (inc id) (+ id 3)))}))
281+
282+
(def QueryRoot
283+
{:person (map->Person {})
284+
:me (map->Person {:id 0})})
285+
286+
(def app
287+
(alumbra/handler
288+
{:schema schema
289+
:query QueryRoot}))
290+
291+
(defonce my-graphql-server
292+
(aleph.http/start-server #'app {:port 3000}))
293+
\`\`\`
294+
295+
\`\`\`bash
296+
$ curl -XPOST "http://0:3000" -H'Content-Type: application/json' -d'{
297+
"query": "{ me { name, friends { name } } }"
298+
}'
299+
{"data":{"me":{"name":"Person #0","friends":[{"name":"Person #1"},{"name":"Person #2"}]}}}
300+
\`\`\`
301+
263302
#### [graphql-clj](https://github.com/tendant/graphql-clj)
264303
265304
A Clojure library that provides a GraphQL implementation.
@@ -286,6 +325,8 @@ Code that executes a hello world GraphQL query with \`graphql-clj\`:
286325
(executor/execute nil type-schema resolver-fn "{ hello }")
287326
\`\`\`
288327
328+
- [lacinia](https://github.com/walmartlabs/lacinia): A full implementation of the GraphQL specification that aims to maintain external compliance with the specification.
329+
289330
### Go
290331
291332
- [graphql-go](https://github.com/graphql-go/graphql): An implementation of GraphQL for Go / Golang.

0 commit comments

Comments
 (0)