'how to add graphql to heroku in a strapi app?
I made a Strapi app using MongoDb, Cloudinary (for the images) and Heroku (for deployment). I installed Graphql before deploying it. It works fine in develop mode in localhost, the graphql playground shows normally. But in production I get an error when trying to show graphql playground. It just shows a blank page with this message:
GET query missing
How can I query my data using graphql/Apollo if the url "some_name.heroku.com/graphql" doesn't work?
Solution 1:[1]
Ok, I found out in a github forum that I had to add some code in the plugins.js file to make graphql work in production. This is the code:
module.exports = ({ env }) => ({
//
graphql: {
config: {
endpoint: "/graphql",
shadowCRUD: true,
playgroundAlways: true,
depthLimit: 100,
apolloServer: {
tracing: false,
},
},
},
});
after that I had to commit the changes in my repo and wait to heroku to deploy it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TOPAiiN |
