From 485f26134830615d2a0d052382b9f231b910a4e1 Mon Sep 17 00:00:00 2001 From: Shashi Kant Date: Wed, 29 May 2024 12:41:46 +0530 Subject: [PATCH] initial commit --- .github/workflows/main.yml | 28 ++++++++++++++++++++++++++++ config.graphql | 28 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/main.yml create mode 100644 config.graphql diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..fa4c511 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,28 @@ +on: [push] + +jobs: + deploy_tailcall: + runs-on: ubuntu-latest + name: Deploy Tailcall + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Deploy Tailcall + id: deploy-tailcall + uses: tailcallhq/gh-action@v0.2 + with: + # mandatory + provider: '' # currently 'aws' and 'fly' are supported + tailcall-config: 'config.graphql' + + # when deploying to aws + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: "us-east-1" + aws-iam-role: "iam_for_tailcall" + terraform-api-token: ${{ secrets.TERRAFORM_API_TOKEN }} + + # when deploying to fly + fly-api-token: ${{ secrets.FLY_API_TOKEN }} + fly-app-name: "tailcall" + fly-region: "lax" diff --git a/config.graphql b/config.graphql new file mode 100644 index 0000000..54fb92a --- /dev/null +++ b/config.graphql @@ -0,0 +1,28 @@ +schema + @server(port: 8000, headers: {cors: {allowOrigins: ["*"], allowHeaders: ["*"], allowMethods: [POST, GET, OPTIONS]}}) + @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { + query: Query +} + +type Query { + posts: [Post] @http(path: "/posts") + users: [User] @http(path: "/users") + user(id: Int!): User @http(path: "/users/{{.args.id}}") +} + +type User { + id: Int! + name: String! + username: String! + email: String! + phone: String + website: String +} + +type Post { + id: Int! + userId: Int! + title: String! + body: String! + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) +}