appsync-example-lambda

module
v0.0.0-...-d1da509 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2019 License: MIT

README

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.

Directories

Path Synopsis
src
people command
person command
person-age command
person-friends command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL