GraphQL

Description

First, make sure you've run npm i -g serverless and added your AWS credentials.
Deploying for the first time can take 10-20 minutes since it needs to create the ElasticSearch instance. If there is an error, you may get ROLLBACK_IN_PROGRESS the next time you try to deploy. Give it a few minutes and then try again.
1
git clone [email protected]:serverless-cqrs/graphql-example.git
2
cd graphql-example
3
npm i
4
serverless deploy
Copied!
Once deployed, navigate to the returned endpoint url and you'll see the graphql playground, where you can run the following queries:
1
mutation {
2
addTodo(id: "123", title: "Get Milk")
3
}
Copied!
1
query {
2
getById(id: "123") {
3
id
4
todos {
5
title
6
completed
7
}
8
}
9
}
Copied!
The AWS Free Tier covers most of these services, but running an ElasticSearch instance on AWS can be expensive. Make sure to run serverless remove once you're done.
Last modified 1yr ago
Copy link