var query =
`{
getPost( orderdesc: likes , first: 1 , offset: 0 , func: type( post ) ){
name
contents
createdby{
name
}
}
}`
;
var res = await fetch( "http://{insertiphere}:8080/graphql?query=" + query + '&operation=getpost&variables={}' )
res = await res.json()
console.dir( res );
output:
'Expected Name, found ('
iluminae
(Kenan Kessler)
2
what you have there is dql right? You are sending it to /graphql. Try using /query instead.
{ errors: [ { message: 'Invalid method', extensions: [Object] } ] }
I had to do fetch with parameters, thank you!