Before | After |
---|---|
App makes an API request and waits. | App makes a GraphQL mutation and then runs a GraphQL subscription to get updates as they happen |
Backend API makes multiple API calls, with complex retry and error handling logic | Business logic in serverless functions get triggered automatically after the mutation |
App receives API response | App gets success/error updates as they happen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" { | |
region = "${var.region}" | |
} | |
### VPC | |
# Fetch AZs in the current region | |
data "aws_availability_zones" "available" {} | |
resource "aws_vpc" "datastore" { | |
cidr_block = "172.17.0.0/16" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query { | |
users { | |
firstName | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- AST1 | |
data ColExpression = ColE ColName [OperationExpression] | |
data BoolExpression = BECol ColExpression | |
data BoolExpression | |
= BEAnd [BoolExpression] | |
| BEOr [BoolExpression] | |
| BENot BoolExpression | |
| BECol ColExpression |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Boolean expression for a column | |
"column": { | |
"_eq": "value", | |
"_gt": "value" | |
} | |
// AND expression | |
"and": { | |
"column1": {...}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Query running against data the DB | |
query { | |
albums { | |
id | |
title | |
} | |
} | |
#Query running against your own code that may or may not talk to the database | |
#These APIs are hosted at: https://graphql-pokemon.now.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query fetchOrders { | |
order (limit: 10, order_by:created_at_desc) { | |
id | |
user_name | |
items { | |
detail { | |
id | |
name | |
} | |
} |
- You have an existing Hasura project, cluster
- You have a microservice running where you can add a webhook
- You have kubectl installed. Check by running:
kubectl get pods -n hasura
which should list all the hasura microservices
Check your platform version:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#An array of artists are returned by a GET query to /v1/artists | |
# artists = [ | |
# { | |
# "name": "...", | |
# "genre": "...", | |
# "albums_recorded": <int>, | |
# "username": "..." | |
# } | |
# ] | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"query": "read", | |
"node": "author", | |
"columns": [ | |
"id", | |
"name", | |
{ | |
"node": "articles", | |
"columns": ["id", "title"] | |
} |