Serverless Javascript w/AWS: Using Javascript and Lambda with a GraphQL API
Details
Code: https://github.com/elovejoy5/sls-js-graphql-demo
So how do we setup a GraphQL API in under an hour?
First, we make a bunch of assumptions:
- working AWS account
- local environment with node, npm, serverless, editor, etc...
- the network is going to be fast enough to let us connect to AWS in Oregon and deploy a few services
- We can setup GraphQL, Lambda functions, roles, policies, userpools, etc... without explaining what all the services are and how they work
Second, we quickly set up a very hello-world GraphQL API:
- Start with a JavaScript Lambda function
- Add a Cognito user pool & a test account
- Add an Appsync instance with a super simple GraphQL API
- Quickly edit the lambda to support the GraphQL API
- Add a layer so that we can use a library without bundling it with the lambda
- Use the library to iterate on our API & Lambda function
Along the way, we'll probably look at yaml files, logging, environment variables, a quick-and-dirty react client, etc...
We'll attempt to live stream here: https://www.youtube.com/watch?v=U2ASfG69yRY
