Skip to content

Commit

Permalink
docs: extended graphql documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sitepark-veltrup committed Dec 20, 2023
1 parent 8826f74 commit 1165dd1
Show file tree
Hide file tree
Showing 15 changed files with 1,547 additions and 354 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ indent_size = 4
indent_size = 2
[*.md]
indent_size = 2
[*.yml]
indent_size = 2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
public/
tmp/
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,29 @@ Install [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/)

```sh
pip install mkdocs-material
```
```

# Building the site
# Update requirements

```sh
pip install --upgrade -r requirements.txt
```

# Update GraphQL API Reference

The API reference `docs/develop/graphql/reference.md` is generated automatically using a GraphQL schema. The script `tools/gen-reference.sh` is available for this purpose. This expects a URL to a GraphQL endpoint via which the schema is to be read.

```sh
./tools/gen-reference.sh https://www.domain.de/graphql
```

This creates the Markdown file `docs/develop/graphql/reference.md` from the schema.

# Building the site

```sh
mkdocs build
```
```

This will create a new directory named `public`` where the generated documentation will be stored.

Expand All @@ -33,4 +48,4 @@ MkDocs comes with a built-in dev-server that lets you preview your documentation

```sh
mkdocs serve
```
```
22 changes: 13 additions & 9 deletions docs/develop/graphql/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
---
status: draft
---

# Get started with GraphQL API.
# Getting started

This guide shows the integration and basic usage of the GraphQL API.

## Requirements

A Symfony 6.3 project with Symfony-Flex is required. In this project the GraphQL endpoint is set up.
A Symfony 6.4 project with Symfony-Flex is required. In this project the GraphQL endpoint is set up.

## Install

Expand All @@ -34,7 +30,6 @@ composer config --json --merge extra.symfony.endpoint \

The installation is then carried out via `composer require`.


```sh
composer require atoolo/graphql-search-bundle
```
Expand All @@ -47,6 +42,10 @@ composer require --dev overblog/graphiql-bundle

## Usage

### Basics

To learn the basics of GraphQL, ["Introduction to GraphQL"](https://graphql.org/learn/) is a good place to start.

### Commandline

You can run GraphQL queries in a curl query in the command line on your local computer. A GraphQL query can be issued as a POST request to `/graphql with the query as the payload.
Expand All @@ -60,9 +59,11 @@ curl "https://www.example.com/graphql/" --fail \
--data '{"query" : "{ ping }"}'
```

### TypeScript
### Clients

Because GraphQL is a communication pattern, there are many tools to help you get started working which support GraphQL in all sorts of languages.

The Apollo client can be used to use the GraphQL interface with TypeScript. See [TypeScript with Apollo Client](https://www.apollographql.com/docs/react/development-testing/static-typing/)
E.g. for JavaScript clients see [here](https://graphql.org/code/#javascript-client)

### GraphiQL

Expand All @@ -72,3 +73,6 @@ With the fictitious endpoint `www.example.com` the GraphiQL can be reached at th

`https://www.example.com/graphiql`

!!! note

Please note, however, that `APP_ENV=dev` must be set.
Loading

0 comments on commit 1165dd1

Please sign in to comment.