Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to handlebars.js #1295

Open
gustavorps opened this issue Sep 5, 2024 · 0 comments
Open

Support to handlebars.js #1295

gustavorps opened this issue Sep 5, 2024 · 0 comments

Comments

@gustavorps
Copy link

What is Handlebars?

Handlebars is a simple templating language.

It uses a template and an input object to generate HTML or other text formats. Handlebars templates look like regular text with embedded Handlebars expressions.

<p>{{firstname}} {{lastname}}</p>

A handlebars expression is a {{, some contents, followed by a }}. When the template is executed, these expressions are replaced with values from an input object.

Example: Making GraphQL Request with Handlebars

###
# @promp stargazers.first:number = 5
# @promp stargazers.nodes.fields:string[] = ["login", "name"]

POST https://api.github.com/graphql
Content-Type: application/json
Authorization: Bearer xxx
X-REQUEST-TYPE: GraphQL

query ($name: String!, $owner: String!) {
  repository(name: $name, owner: $owner) {
    name
    fullName: nameWithOwner
    description
    diskUsage
    forkCount
    {{#with stargazers}}
    stargazers(first: {{first.value}}) {
        totalCount
        nodes {
          {{#each nodes.fields}}
            {{item}}
          {{/each}}
        }
    }
    {{/with}}
    watchers {
        totalCount
    }
  }
}

{
    "name": "vscode-restclient",
    "owner": "Huachao"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant