SHA256
moved study stuff
This commit is contained in:
1 parent
8eeb419ba4
commit
888fe03d46
37 files changed
No files matched your search
@@ -0,0 +1,43 @@
|
||||
# GraphQL
|
||||
GraphQL is an FOSS agnostic query adaptor that allows you to query data from many different data sources. GraphQL is used to build APIs where clients will send a query for nested data. GraphQL mitigates the issue of versioned or rapidly changing APIs compared to REST APIs because you can request the data you want.
|
||||
|
||||
GraphQL schemas are written in the GraphQL SDL (Schema Definition Language) composed on:
|
||||
- **Types**. Represent objects and their **fields**:
|
||||
```graphql
|
||||
type Query {
|
||||
me: User
|
||||
}
|
||||
|
||||
type User {
|
||||
id: ID
|
||||
name: String
|
||||
}
|
||||
```
|
||||
- **Fields**
|
||||
- **Queries**. Define the exact shape of the data needed by the client:
|
||||
```graphql
|
||||
query CurrentUser {
|
||||
currentUser {
|
||||
name
|
||||
age
|
||||
}
|
||||
}
|
||||
```
|
||||
- **Mutations**. Allow for data to be create, updated or deleted:
|
||||
```graphql
|
||||
mutation CreateUser($name: String!, $age: Int!) {
|
||||
createUser(userName: $name, age: $age) {
|
||||
name
|
||||
age
|
||||
}
|
||||
}
|
||||
```
|
||||
- **Subscriptions**. Supports live updates sent from the server to the client:
|
||||
```graphql
|
||||
subscription {
|
||||
newPerson {
|
||||
name
|
||||
age
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in new issue
Block a user