File tree 2 files changed +84
-3
lines changed
2 files changed +84
-3
lines changed Original file line number Diff line number Diff line change @@ -2,3 +2,82 @@ GraphQLite
2
2
=======
3
3
4
4
GraphQLite is an experimental implementation of Facebook's GraphQL.
5
+
6
+ ## Installation
7
+
8
+ ``` sh
9
+ $ npm install graphqlite
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ GraphQLite exposes a simple API for parsing GraphQL (uses ES6 multi-line strings).
15
+
16
+ ``` javascript
17
+ var graphqlite = require (' graphqlite' )
18
+
19
+ var output = graphqlite .parse (`
20
+ node(123) {
21
+ id,
22
+ name,
23
+ birthdate {
24
+ month,
25
+ day,
26
+ },
27
+ friends.first(1) {
28
+ cursor,
29
+ node {
30
+ name
31
+ }
32
+ }
33
+ }
34
+ ` )
35
+ ```
36
+
37
+ In the above example, ` output ` will be:
38
+
39
+ ``` javascript
40
+ [
41
+ {
42
+ calls: [{ type: ' node' , param: 123 }],
43
+ fields: {
44
+ id: true ,
45
+ name: true ,
46
+ birthdate: {
47
+ calls: [],
48
+ fields: {
49
+ month: true ,
50
+ day: true
51
+ }
52
+ },
53
+ friends: {
54
+ calls: [ { type: ' first' , param: 1 }],
55
+ fields: {
56
+ cursor: true ,
57
+ node: {
58
+ calls: [],
59
+ fields: {
60
+ name: true
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
67
+ ]
68
+ ```
69
+
70
+ ## Roadmap
71
+ Facebook will be releasing a GraphQL module in the future, but I didn't know what to expect from this
72
+ so I created this basic one as an experiment.
73
+ Therefore this module could become obselete in the future.
74
+
75
+ I do plan on adding some additional features though:
76
+ - GraphQL generation from object
77
+ - Other ideas welcome
78
+
79
+ ## License
80
+
81
+ Licensed under the MIT License.
82
+
83
+ View the full license [ here] ( https://raw.githubusercontent.com/madjam002/graphqlite/master/LICENSE ) .
Original file line number Diff line number Diff line change 15
15
" graphql" ,
16
16
" react"
17
17
],
18
+ "repository" : {
19
+ "type" : " git" ,
20
+ "url" : " git://github.com/madjam002/graphqlite.git"
21
+ },
18
22
"author" :
" Jamie Greeff <[email protected] >" ,
19
23
"license" : " MIT" ,
20
- "dependencies" : {
21
- "pegjs" : " ^0.8.0"
22
- },
24
+ "dependencies" : {},
23
25
"devDependencies" : {
24
26
"babel-jest" : " ^4.0.0" ,
25
27
"jest-cli" : " ^0.4.0"
You can’t perform that action at this time.
0 commit comments