From c6f166f7a545c2f992637c607e9bd48c8a78bcfe Mon Sep 17 00:00:00 2001 From: Bishal Date: Sun, 3 Mar 2024 08:58:15 +0000 Subject: [PATCH] fixed prettier formatting --- docs/guides/mustache.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/guides/mustache.md b/docs/guides/mustache.md index 30dbec204..0b3fd45b1 100644 --- a/docs/guides/mustache.md +++ b/docs/guides/mustache.md @@ -17,6 +17,7 @@ To get a list of todos you will run the query `todo` defined below. query: Query } ``` + In this example, the `@upstream` operator is used to specify the baseURL as "https://jsonplaceholder.typicode.com". This baseURL will be used as the base URL for all HTTP requests defined within the schema. ```graphql @@ -61,11 +62,8 @@ Suppose you have an API that requires authentication through a token. You can us ```graphql type Query { - protectedResource: [Resource] - @http( - path: "/protected/resource", - headers: [{key: "Authorization", value: "Bearer {{env.AUTH_TOKEN}}"}] - ) + protectedResource: [Resource] + @http(path: "/protected/resource", headers: [{key: "Authorization", value: "Bearer {{env.AUTH_TOKEN}}"}]) } type Resource { @@ -73,6 +71,7 @@ type Resource { name: String! } ``` + In this example, the `protectedResource` query fetches data from an API endpoint that requires authentication. The `Authorization` header is included in the HTTP request with the value `Bearer {{env.AUTH_TOKEN}}`. Here, `env.AUTH_TOKEN` holds the authentication token. With Mustache templates, we dynamically insert the token into the header, ensuring proper authentication with the token from the environment.