From 7662e034074f956031d0506a1fec61b388950363 Mon Sep 17 00:00:00 2001 From: laststylebender Date: Tue, 10 Sep 2024 11:07:13 +0530 Subject: [PATCH 1/7] - added steps to run the tailcall configuration. --- projects/tailcall/run.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 projects/tailcall/run.sh diff --git a/projects/tailcall/run.sh b/projects/tailcall/run.sh new file mode 100755 index 0000000..c25ff34 --- /dev/null +++ b/projects/tailcall/run.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +# TODO: implement installation +npm install -g @tailcallhq/tailcall + +# TODO: run the server +tailcall start reference/schema.graphql \ No newline at end of file From 275b09bd5b54628941ac1d8e176bc3ff28129a6a Mon Sep 17 00:00:00 2001 From: laststylebender Date: Tue, 10 Sep 2024 11:57:18 +0530 Subject: [PATCH 2/7] - set the correct directory for configuration. --- projects/tailcall/run.sh | 11 ++++++++--- .../tailcall/tailcall.graphql | 0 2 files changed, 8 insertions(+), 3 deletions(-) rename reference/schema.graphql => projects/tailcall/tailcall.graphql (100%) diff --git a/projects/tailcall/run.sh b/projects/tailcall/run.sh index c25ff34..f08e600 100755 --- a/projects/tailcall/run.sh +++ b/projects/tailcall/run.sh @@ -2,8 +2,13 @@ set -e -# TODO: implement installation npm install -g @tailcallhq/tailcall -# TODO: run the server -tailcall start reference/schema.graphql \ No newline at end of file +# Get the directory of the script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Set the path to the schema file relative to the script location +SCHEMA_FILE="${SCRIPT_DIR}/tailcall.graphql" + +# Start Tailcall +tailcall start "${SCHEMA_FILE}" \ No newline at end of file diff --git a/reference/schema.graphql b/projects/tailcall/tailcall.graphql similarity index 100% rename from reference/schema.graphql rename to projects/tailcall/tailcall.graphql From 40b08db4e1f7a286b2743edd9826549742bfb9fc Mon Sep 17 00:00:00 2001 From: laststylebender Date: Tue, 10 Sep 2024 11:59:46 +0530 Subject: [PATCH 3/7] - revert: added deleted file. --- reference/schema.graphql | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 reference/schema.graphql diff --git a/reference/schema.graphql b/reference/schema.graphql new file mode 100644 index 0000000..e43b09b --- /dev/null +++ b/reference/schema.graphql @@ -0,0 +1,40 @@ +schema + @server(port: 8089) + @upstream(baseURL: "http://localhost:3000") { + query: Query +} + +type Query { + posts: [Post] @http(path: "/posts") + post(id: Int!): Post @http(path: "/posts/{{.args.id}}") + users: [User] @http(path: "/users") + user(id: Int!): User @http(path: "/users/{{.args.id}}") +} + +type Post { + id: Int + userId: Int! + title: String + body: String + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) +} + +type User { + id: Int + name: String + username: String + email: String + address: Address + phone: String + website: String +} + +type Address { + zipcode: String + geo: Geo +} + +type Geo { + lat: Float + lng: Float +} From 17ee2550de61a15575f9fcbedcadf70458e6c15e Mon Sep 17 00:00:00 2001 From: laststylebender Date: Tue, 10 Sep 2024 12:03:28 +0530 Subject: [PATCH 4/7] - update the port. --- projects/tailcall/tailcall.graphql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/tailcall/tailcall.graphql b/projects/tailcall/tailcall.graphql index e43b09b..42ca0fd 100644 --- a/projects/tailcall/tailcall.graphql +++ b/projects/tailcall/tailcall.graphql @@ -1,5 +1,5 @@ schema - @server(port: 8089) + @server(port: 8000) @upstream(baseURL: "http://localhost:3000") { query: Query } From a272690f6097eecfb00f540092980132963a45d6 Mon Sep 17 00:00:00 2001 From: laststylebender Date: Tue, 10 Sep 2024 12:55:36 +0530 Subject: [PATCH 5/7] - optimise the configuration. --- projects/tailcall/tailcall.graphql | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/projects/tailcall/tailcall.graphql b/projects/tailcall/tailcall.graphql index 42ca0fd..b44085f 100644 --- a/projects/tailcall/tailcall.graphql +++ b/projects/tailcall/tailcall.graphql @@ -1,6 +1,6 @@ schema - @server(port: 8000) - @upstream(baseURL: "http://localhost:3000") { + @server(port: 8000, dedupe: true) + @upstream(baseURL: "http://localhost:3000", batch: {delay: 1}) { query: Query } @@ -16,7 +16,12 @@ type Post { userId: Int! title: String body: String - user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) + user: User + @http( + path: "/users" + query: [{key: "id", value: "{{.value.userId}}"}] + batchKey: ["id"] + ) } type User { From 8bbf3dfe8d919482ae82e412682dd0a2cb3401dc Mon Sep 17 00:00:00 2001 From: meskill <8974488+meskill@users.noreply.github.com> Date: Tue, 10 Sep 2024 09:24:32 +0000 Subject: [PATCH 6/7] disable logs --- projects/tailcall/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/tailcall/run.sh b/projects/tailcall/run.sh index f08e600..14ea9f8 100755 --- a/projects/tailcall/run.sh +++ b/projects/tailcall/run.sh @@ -11,4 +11,4 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" SCHEMA_FILE="${SCRIPT_DIR}/tailcall.graphql" # Start Tailcall -tailcall start "${SCHEMA_FILE}" \ No newline at end of file +TAILCALL_LOG_LEVEL=error TC_TRACKER=false tailcall start "${SCHEMA_FILE}" From 003635aebbfb349b2e4f393a78537793598fcc1e Mon Sep 17 00:00:00 2001 From: meskill <8974488+meskill@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:13:50 +0000 Subject: [PATCH 7/7] rename project --- projects/{tailcall => tailcallhq}/run.sh | 2 ++ projects/{tailcall => tailcallhq}/tailcall.graphql | 0 2 files changed, 2 insertions(+) rename projects/{tailcall => tailcallhq}/run.sh (92%) rename projects/{tailcall => tailcallhq}/tailcall.graphql (100%) diff --git a/projects/tailcall/run.sh b/projects/tailcallhq/run.sh similarity index 92% rename from projects/tailcall/run.sh rename to projects/tailcallhq/run.sh index 14ea9f8..066d38c 100755 --- a/projects/tailcall/run.sh +++ b/projects/tailcallhq/run.sh @@ -10,5 +10,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Set the path to the schema file relative to the script location SCHEMA_FILE="${SCRIPT_DIR}/tailcall.graphql" +echo "Starting the server" + # Start Tailcall TAILCALL_LOG_LEVEL=error TC_TRACKER=false tailcall start "${SCHEMA_FILE}" diff --git a/projects/tailcall/tailcall.graphql b/projects/tailcallhq/tailcall.graphql similarity index 100% rename from projects/tailcall/tailcall.graphql rename to projects/tailcallhq/tailcall.graphql