https://github.com/sashee/appsync-resolve-complex-types
Sample code for how to resolve complex types with resolvers
https://github.com/sashee/appsync-resolve-complex-types
appsync aws graphql
Last synced: 6 months ago
JSON representation
Sample code for how to resolve complex types with resolvers
- Host: GitHub
- URL: https://github.com/sashee/appsync-resolve-complex-types
- Owner: sashee
- Created: 2022-06-05T10:29:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-06T08:15:04.000Z (over 3 years ago)
- Last Synced: 2025-03-24T08:41:18.114Z (11 months ago)
- Topics: appsync, aws, graphql
- Language: HCL
- Homepage: https://advancedweb.hu/how-to-resolve-complex-types-with-appsync-resolvers/
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sample code for how to resolve complex types with resolvers
## Deploy
* ```terraform init```
* ```terraform apply```
## Usage
Get all groups with all users:
```graphql
query MyQuery {
allGroups {
id
users {
name
id
}
}
}
```
Get a group by id:
```graphql
query MyQuery {
group(id: "1") {
id
users {
id
name
}
}
}
```
Get a user by id:
```graphql
query MyQuery {
user(id: "1") {
id
name
}
}
```
## How it works
All 3 queries are resolved by a single Lambda function returning a complex structure that matches the GraphQL schema. Lists are returned as Arrays, and Types are Objects.
## Cleanup
* ```terraform destroy```