Simple sample app using Serverless Application Framework, TypeScript and Apollo GraphQL on AWS.
Uses DynamoDB and a REST API based on CrudCrud as data provider.
- Integrates serverless webpack
- Integrates serverless offline
- Integrates serverless layers
- Adds GraphQL Playground
- Uses Prettier
- Uses ESLint
- Modularizes GraphQL schema
- Fetches data from DynamoDB and a REST API
- Setup your AWS credentials to work with Serverless (Guide)
- Get an endpoint identifier from CrudCrud and set it in serverless.yml
- Run
npm install
- Run
npm run deploy
- Deploy first (to setup remote DynamoDB)
- Run
npm run offline
- Go to
http://localhost:3000/local/playground
and play around
Data samples in JSON can be found for DynamoDB and CrudCrud respectively.
query {
mountainPasses {
name
elevation
length
maxGradient
from {
name
postalCode
population
area
}
to {
name
postalCode
population
area
}
}
}
{
"data": {
"mountainPasses": [
{
"name": "Furka",
"elevation": 2429,
"length": 28,
"maxGradient": 0.11,
"from": {
"name": "Realp",
"postalCode": 6491,
"population": 153,
"area": 77.97
},
"to": {
"name": "Oberwald",
"postalCode": 3999,
"population": 277,
"area": 96.9
}
},
{
"name": "St. Gotthard",
"elevation": 2107,
"length": 27,
"maxGradient": 0.08,
"from": {
"name": "Göschenen",
"postalCode": 6487,
"population": 448,
"area": 104.31
},
"to": {
"name": "Airolo",
"postalCode": 6780,
"population": 1501,
"area": 94.5
}
}
]
}
}