So I am building an app using express js ,graphql, postgres and react. And I have already build my backend but now instead of using react, I want to use GatsbyJs how do I connect my express graphiql with my Gatsby graphiql or send my data directly to Gatsby graphiql
1
votes
Please show your code or what have you done so far. Please have a look at stackoverflow.com/help/how-to-ask
- Nima Derakhshanjan
gatsbyjs.org/packages/gatsby-source-graphql
- ksav
@ksav thank you i just started learning gatsby and that helped
- shakir khan
@shakirkhan I'm glad it helped. Good luck with the app
- ksav
1 Answers
0
votes
Add the following in gatsby-config.js
module.exports = {
plugins: [
{
resolve: "gatsby-source-graphql",
options: {
// This type will contain remote schema Query type
typeName: "MyGraph",
// This is the field under which it's accessible
fieldName: "myGraph",
// URL to query from
url: "http://localhost:4000/graphql",
},
},
],
}
Then in say index.js make the query
export const query = graphql
query {
myGraph {
users {
name
age
}
}
}