micro-graphql-react
micro-graphql-react copied to clipboard
add support for POST (#75)
Resolves #75
The tests seem sort of hard to add a new client to, so I skipped it, but I implemented the actual functionality. Additionally, https://mylibrary.io/graphql-public seems down, and I can't get the demo-project to build as it is. This is a pretty simple change, though, and I tested with this code:
import { Client, setDefaultClient } from './dist/index.min.js'
const client = new Client({
endpoint: 'http://localhost:3000/api',
fetchOptions: { method: 'POST' }
})
setDefaultClient(client)
const QUERY_TEST = `
{
hello(name: "David")
}
`
console.log(await client.runQuery(QUERY_TEST, {}))
on a POST-only graphql server, I get this:
{ data: { hello: 'Hello David' } }