Skip to content

Commit

Permalink
Add: all instructions to demos
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldanielecki committed Jul 1, 2024
1 parent 05bf3ef commit 63ba084
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 25 deletions.
50 changes: 27 additions & 23 deletions _code/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Demo part instructions

## Demo optional
## Demo Optional

### Simplest example of GraphQL query

Expand Down Expand Up @@ -147,7 +147,7 @@ query {

##### Show `200 OK` Status Code under `Preview` of request even if this resource doesn't return anything: `http://localhost:1234`

#### Show executing create mutation
#### Show executing create mutation: `http://localhost:4000/graphql`

```graphql
mutation {
Expand All @@ -174,7 +174,15 @@ query {

##### Refresh `index.html`/`index.js` to show also `Daniel` popping up: `http://localhost:1234`

## Demo error
#### Show Subscription: `http://localhost:4000/graphql`

```graphql
subscription {
count
}
```

## Demo Error

### Let's see an error

Expand Down Expand Up @@ -219,11 +227,11 @@ mutation {

##### Show it inside the code `throw new GraphQLError("Email taken");` to highlight no REST-like status codes, but `GraphQL` ones

## Demo introspection
## Demo Introspection

### Introspection in practice

#### Show basic introspection
#### Show basic introspection: `http://localhost:4000/graphql`

```graphql
{
Expand All @@ -235,7 +243,7 @@ mutation {
}
```

#### Show some information about query
#### Show some information about query: `http://localhost:4000/graphql`

```graphql
{
Expand All @@ -247,7 +255,7 @@ mutation {
}
```

#### Show some information about Post
#### Show some information about Post: `http://localhost:4000/graphql`

```graphql
{
Expand All @@ -257,7 +265,7 @@ mutation {
}
```

#### Show more information about Post
#### Show more information about Post: `http://localhost:4000/graphql`

```graphql
{
Expand All @@ -268,7 +276,7 @@ mutation {
}
```

#### Show some information about CreateUserInput
#### Show some information about CreateUserInput: `http://localhost:4000/graphql`

```graphql
{
Expand All @@ -279,7 +287,7 @@ mutation {
}
```

#### Show even more information about Post
#### Show even more information about Post: `http://localhost:4000/graphql`

```graphql
{
Expand All @@ -296,7 +304,7 @@ mutation {
}
```

#### Show last introspection about Post
#### Show last introspection about Post: `http://localhost:4000/graphql`

```graphql
{
Expand All @@ -317,11 +325,13 @@ mutation {
}
```

##### After that, show how `useDisableIntrospection()` works by simply uncommenting it and reloading the page.
##### After that, show how `useDisableIntrospection()` works by simply uncommenting it and reloading the page: `http://localhost:4000/graphql`

## Demo Circular Queries

### Circular Queries
### Digging with nesting

(show users query with 5 fields and nested posts, author, posts and author)
#### Show users query with 5 fields and nested posts, author, posts and author: `http://localhost:4000/graphql`

```graphql
query {
Expand Down Expand Up @@ -358,17 +368,11 @@ query {
}
```

### Apollo Client demo

(little example how it looks in reality in frontend)

1. `yarn start` in `graphql-prisma`
2. `yarn start` in `apollo-client`
3. Open `localhost:1234`
## Demo Unit Testing

### Testing demo
### Unit Testing in GraphQL

(shortly show tested 1 of each: query, mutation, and subscription)
#### Shortly show tested 1 of each: query, mutation, and subscription

1. `cd _code`
2. `cd unit-testing`
Expand Down
2 changes: 1 addition & 1 deletion _code/unit-testing/jest/setup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import server from "./../../graphql-basics/src/index.js";
import server from "./../../graphql-sample/src/index.js";

export default async () => {
global.httpServer = await server;
Expand Down
9 changes: 8 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ <h2>Error Handling: GraphQL</h2>
</code></pre>
</section>
<section>
<h2>Demo</h2>
<h1>Demo</h1>
<p>Let's see an error.</p>
</section>
<section>
Expand Down Expand Up @@ -575,6 +575,13 @@ <h1>Demo</h1>
<section>
<img data-src="assets/owasp-introspection.png">
</section>
<section>
<h1>Circular Queries</h1>
</section>
<section>
<h1>Demo</h1>
<p>Digging with nesting.</p>
</section>
<section>
<h1>Standardization<br>vs<br>Fragmentation</h1>
</section>
Expand Down

0 comments on commit 63ba084

Please sign in to comment.