Skip to content

Commit

Permalink
fixed prettier formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ibishal committed Mar 3, 2024
1 parent a05b651 commit c6f166f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions docs/guides/mustache.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -61,18 +62,16 @@ 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 {
id: ID!
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.
Expand Down

0 comments on commit c6f166f

Please sign in to comment.