Skip to content
GraphQL API using AWS AppSync, SAM, Lambda functions w/ Go
Go Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
data
src
.gitignore
CODE_OF_CONDUCT.md
LICENSE.md
Makefile
README.md
go.mod
go.sum
schema.graphql
template.yml

README.md

AppSync Example w/ Lambda

MIT License Read Tutorial

Deploy a GraphQL API using AWS AppSync, Serverless Application Model, and AWS Lambda functions using Go. Read more about the implementation details in our blog post about AppSync and GraphQL.

Schema

type Person {
	id: Int!
	name: String!
	age: Int!
	birthday: String!

	friends: [Person!]!
}

type Query {
	people: [Person!]!
	person(id: Int): Person!
}

schema {
	query: Query
}

Usage

Deployment

# Create S3 Bucket for CloudFormation Artifacts
$ > AWS_PROFILE=your-profile-name \
    make configure

# Build, Package, and Deploy the CloudFormation Stack
$ > AWS_PROFILE=your-profile-name \
    make build package deploy

API Access

# Print GraphQL API Endoint
$ > AWS_PROFILE=your-profile-name \
    make outputs-GraphQL

https://tdk6mhrty7ii.appsync-api.eu-central-1.amazonaws.com/graphql

# Print AppSync API Key
$ > AWS_PROFILE=your-profile-name \
    make outputs-APIKey

da2-1jdf4nmbwpsdr4vfxcxfza

Example

$ > curl \
    -XPOST https://tdk6mhrty7ii.appsync-api.eu-central-1.amazonaws.com/graphql \
    -H "Content-Type:application/graphql" \
    -H "x-api-key:da2-1jdf4nmbwpsdr4vfxcxfza" \
    -d '{ "query": "query { people { name } }" }' | jq

Resolvers

  • Query.people
  • Query.person
  • Field.person.age
  • Field.person.friends

License

Feel free to use the code, it's released using the MIT license.

Contribution

You are welcome to contribute to this project! 😘

To make sure you have a pleasant experience, please read the code of conduct. It outlines core values and beliefs and will make working together a happier experience.

You can’t perform that action at this time.