A graphql server that dynamically updates its schema from your Kentico Cloud instance using webhooks.
- Installed latest stable NodeJS
- Installed yarn
KENTICO_CLOUD_PROJECT_ID
— RequiredGRAPHQL_SERVER_PORT
— Optional (default4000
)GRAPHQL_SERVER_PATH
— Optional (default/graphql
) Note: remember the forward slash
bash - How do I add environment variables?
yarn
yarn start
http://0.0.0.0:4000/graphql
Note: If you changed the port or path your URL will be different to the above.
This server prescribes Kentico Cloud as a data source, but you are free to add other sources that your GraphQL API can exposes with your Kentico Cloud data.
-
Add your schema in the
schema
folder. The schema should have a.graphql
extension and be pure, valid graphql schema — as opposed to — an exported module, string orgql
function. You do not need to add this file to the index, new schemas will be picked up automatically. -
Add your resolvers in the
resolvers
folder. Your resolvers file should export a default object with one or more resolvers that map to your schema. You do not need to add this file to the index, new resolvers will be picked up automatically.
For more information on how to build schemas and resolvers, check out the Apollo server documentation:
https://www.apollographql.com/docs/apollo-server/essentials/schema.html
https://www.apollographql.com/docs/apollo-server/essentials/data.html
Should you need to generate the schema without running the server, you can run:
yarn run generate-schema
Your schema will be generated in the following location: schema/kentico-cloud-schema.graphql