Skip to content
Graffle is a work in progress. Learn more.

Gql String

This example shows how to send a request using a string for the GraphQL document.

ts

import { 
Graffle
} from 'graffle'
const
graffle
=
Graffle
.
create
().
transport
({
url
: `http://localhost:3000/graphql` })
const
data
= await
graffle
.
gql
`
{ pokemons { name } } `.
send
()
console.log(
data
)

Outputs

txt
{
  pokemons: [
    { name: 'Pikachu' },
    { name: 'Charizard' },
    { name: 'Squirtle' },
    { name: 'Bulbasaur' },
    { name: 'Caterpie' },
    { name: 'Weedle' }
  ]
}

Released under the MIT License.