https://github.com/drklrd/graphql-apollo-part-1
PART - I [Graphql-Apollo]
https://github.com/drklrd/graphql-apollo-part-1
Last synced: over 1 year ago
JSON representation
PART - I [Graphql-Apollo]
- Host: GitHub
- URL: https://github.com/drklrd/graphql-apollo-part-1
- Owner: drklrd
- Created: 2017-08-23T14:56:05.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-23T14:58:01.000Z (almost 9 years ago)
- Last Synced: 2025-02-16T01:31:41.638Z (over 1 year ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## PART - I [Graphql-Apollo]
Part One for the Udemy's GraphQL course. Focussing only on the backend part.
```javascript
query {
user(id: "23"){
friends {
company {
name
}
}
}
}
```
Rootquery is like entry point of data . RootQuery allows to jump at very specific node.
Resolve function resolves differences between incoming data model and datatype we are trying to use in graphQL
### Naming the query :
```javascript
query findCompany{
company(id : "1"){
id
name
}
}
```
Multiple query for same type ....
```javascript
{
apple : company(id : "1"){
id
name
}
google : company(id : "1"){
id
name
}
}
```
### Query fragments... essentially just a list of properties we want to get access to.
```javascript
{
apple : company(id : "1"){
...companyDetails
}
google : company(id : "1"){
...companyDetails
}
}
fragment companyDetails on Company{
id
name
description
}
```
### mutation
```javascript
mutation {
addUser(firstName:"Mero",age:23){
id
firstName
age
}
}
```
#### Delete user
```javascript
mutation{
deleteUser(id:"23"){
id
}
}
```
### Also consider going through :
Apollo developers
dev.apollodata.com/react/cache-updates.html