Skip to content

Commit a431b06

Browse files
author
Julien Neuhart
committed
Update GraphQL documentation
1 parent 0ed3aaa commit a431b06

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

docs/docs/06_GraphQL/1_Overview.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,44 @@ slug: /graphql
1010
>
1111
> -- <cite>[graphql.org](https://graphql.org/)</cite>
1212
13+
## API
14+
1315
The Symfony Boilerplate uses [GraphQLite](https://graphqlite.thecodingmachine.io/) to quickly build a GraphQL API based
1416
on your models and use cases.
1517

1618
As the documentation of this PHP library covers a lot of aspects, we invite you to read it to have a better understanding
1719
of its functionalities.
1820

21+
## Client
22+
23+
The Symfony Boilerplate uses [graphql-request](https://github.com/prisma-labs/graphql-request) client.
24+
25+
It is available in a Vue component thanks to `this.$graphql`.
26+
27+
Queries and mutations are JavaScript files. For instance:
28+
29+
```js title="src/webapp/graphql/auth/me.query.js"
30+
import { gql } from 'graphql-request'
31+
import { MeFragment } from '@/graphql/auth/me.fragment'
32+
33+
export const MeQuery = gql`
34+
query me {
35+
me {
36+
... on User {
37+
...MeFragment
38+
}
39+
}
40+
}
41+
${MeFragment}
42+
`
43+
```
44+
45+
:::note
46+
47+
📣&nbsp;&nbsp;A fragment is useful is you want to fetch the same data in many queries and mutations.
48+
49+
:::
50+
1951
## Tools
2052

2153
The API provides the endpoint `/graphiql` (in development) so that you may quickly test a query or a mutation.

0 commit comments

Comments
 (0)