Enable Modules
Enable Next.js and Next.js GraphQL modules
- Visit
/admin/modules
. - Enable the following modules: Next.js, Next.js GraphQL, GraphQL Compose: Edges, GraphQL Compose: Routes.
Configure GraphQL Compose
- Visit
/admin/config/graphql_compose
. - Enable "GraphQL", "Single Query", "Edge Query", & "Loading by Route" for the Article content type.
- Enable all of the fields for the Article content type.
- Do the same for the Basic page content type.
Try GraphQL
If you visit /admin/config/graphql/servers/manage/graphql_compose_server/explorer
on your site, you should see an example server created for you.
You can start testing GraphQL queries. Let's make our first request to fetch the first 5 articles.
Copy and paste the following in the query text input and click the Execute Query (▶) button.
query Articles { nodeArticles(first: 5) { nodes { title } }}
You should see the first 5 articles returned on the right.