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
Cannot query from directus endpoint #4754
Comments
You're providing the query wrong in Axios 🙂 https://medium.com/@stubailo/how-to-call-a-graphql-server-with-axios-337a94ad6cf9 has a good example on how to do a GraphQL query request from Axios 👍🏻 |
const axios = require('axios');
let data = JSON.stringify({
query: `query {
items {
project {
title,
id
}
}
}`,
variables: {}
});
let config = {
method: 'get',
url: 'http://localhost:8055/graphql',
headers: {
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
}); Code straight from Postman. Or use the link above from @rijkvanzanten |
Thanks, I was querying like this for wp-graphql so I though it was the same. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Project details
Directus Version: 9.0.0-rc.51
Environment: production
OS: Linux 5.4.0-67-generic
Node: 10.19.0
I'm using latest installment of Directus and I'm trying to query from graphql endpoint with axios
And I'm getting this as a response
Any idea why is this happening?
The text was updated successfully, but these errors were encountered: