Skip to content

Commit 26c7de8

Browse files
fix sidebar for documentation and /api-v16 (#4331)
Co-authored-by: Jovi De Croock <[email protected]>
1 parent d5c1e8d commit 26c7de8

18 files changed

+58
-41
lines changed

website/next.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/* eslint-disable camelcase */
22
import path from 'node:path';
3+
import fs from 'node:fs';
4+
5+
const fileContents = fs.readFileSync('./vercel.json', 'utf-8');
6+
const vercel = JSON.parse(fileContents);
37

48
import nextra from 'nextra';
59

@@ -29,6 +33,7 @@ export default withNextra({
2933
});
3034
return config;
3135
},
36+
redirects: async () => vercel.redirects,
3237
output: 'export',
3338
images: {
3439
loader: 'custom',

website/pages/_meta.ts

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,8 @@
11
const meta = {
2-
index: '',
3-
'-- 1': {
4-
type: 'separator',
5-
title: 'GraphQL.JS Tutorial',
2+
docs: {
3+
type: 'page',
4+
title: 'Documentation',
65
},
7-
'getting-started': '',
8-
'running-an-express-graphql-server': '',
9-
'graphql-clients': '',
10-
'basic-types': '',
11-
'passing-arguments': '',
12-
'object-types': '',
13-
'mutations-and-input-types': '',
14-
'authentication-and-express-middleware': '',
15-
'-- 2': {
16-
type: 'separator',
17-
title: 'Advanced Guides',
18-
},
19-
'constructing-types': '',
20-
'oneof-input-objects': 'OneOf input objects',
21-
'defer-stream': '',
22-
'-- 3': {
23-
type: 'separator',
24-
title: 'FAQ',
25-
},
26-
'going-to-production': '',
276
'api-v16': {
287
type: 'menu',
298
title: 'API',

website/pages/docs/_meta.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const meta = {
2+
index: '',
3+
'-- 1': {
4+
type: 'separator',
5+
title: 'GraphQL.JS Tutorial',
6+
},
7+
'getting-started': '',
8+
'running-an-express-graphql-server': '',
9+
'graphql-clients': '',
10+
'basic-types': '',
11+
'passing-arguments': '',
12+
'object-types': '',
13+
'mutations-and-input-types': '',
14+
'authentication-and-express-middleware': '',
15+
'-- 2': {
16+
type: 'separator',
17+
title: 'Advanced Guides',
18+
},
19+
'constructing-types': '',
20+
'oneof-input-objects': '',
21+
'defer-stream': '',
22+
'-- 3': {
23+
type: 'separator',
24+
title: 'FAQ',
25+
},
26+
'going-to-production': '',
27+
};
28+
29+
export default meta;

website/pages/basic-types.mdx renamed to website/pages/docs/basic-types.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,4 @@ console.log('Running a GraphQL API server at localhost:4000/graphql');
112112
113113
If you run this code with `node server.js` and browse to http://localhost:4000/graphql you can try out these APIs.
114114
115-
These examples show you how to call APIs that return different types. To send different types of data into an API, you will also need to learn about [passing arguments to a GraphQL API](/passing-arguments/).
115+
These examples show you how to call APIs that return different types. To send different types of data into an API, you will also need to learn about [passing arguments to a GraphQL API](./passing-arguments).
File renamed without changes.

website/pages/getting-started.mdx renamed to website/pages/docs/getting-started.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,4 @@ You should see the GraphQL response printed out:
109109

110110
Congratulations - you just executed a GraphQL query!
111111

112-
For practical applications, you'll probably want to run GraphQL queries from an API server, rather than executing GraphQL with a command line tool. To use GraphQL for an API server over HTTP, check out [Running an Express GraphQL Server](/running-an-express-graphql-server/).
112+
For practical applications, you'll probably want to run GraphQL queries from an API server, rather than executing GraphQL with a command line tool. To use GraphQL for an API server over HTTP, check out [Running an Express GraphQL Server](./running-an-express-graphql-server).

website/pages/graphql-clients.mdx renamed to website/pages/docs/graphql-clients.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: GraphQL Clients
44

55
Since a GraphQL API has more underlying structure than a REST API, there are more powerful clients like [Relay](https://facebook.github.io/relay/) which can automatically handle batching, caching, and other features. But you don't need a complex client to call a GraphQL server. With `graphql-http`, you can just send an HTTP POST request to the endpoint you mounted your GraphQL server on, passing the GraphQL query as the `query` field in a JSON payload.
66

7-
For example, let's say we mounted a GraphQL server on http://localhost:4000/graphql as in the example code for [running an Express GraphQL server](/running-an-express-graphql-server/), and we want to send the GraphQL query `{ hello }`. We can do this from the command line with `curl`. If you paste this into a terminal:
7+
For example, let's say we mounted a GraphQL server on http://localhost:4000/graphql as in the example code for [running an Express GraphQL server](./running-an-express-graphql-server), and we want to send the GraphQL query `{ hello }`. We can do this from the command line with `curl`. If you paste this into a terminal:
88

99
```bash
1010
curl -X POST \
@@ -42,9 +42,9 @@ You should see the data returned, logged in the console:
4242
data returned: Object { hello: "Hello world!" }
4343
```
4444

45-
In this example, the query was just a hardcoded string. As your application becomes more complex, and you add GraphQL endpoints that take arguments as described in [Passing Arguments](/passing-arguments/), you will want to construct GraphQL queries using variables in client code. You can do this by including a keyword prefixed with a dollar sign in the query, and passing an extra `variables` field on the payload.
45+
In this example, the query was just a hardcoded string. As your application becomes more complex, and you add GraphQL endpoints that take arguments as described in [Passing Arguments](./passing-arguments), you will want to construct GraphQL queries using variables in client code. You can do this by including a keyword prefixed with a dollar sign in the query, and passing an extra `variables` field on the payload.
4646

47-
For example, let's say you're running the example server from [Passing Arguments](/passing-arguments/) that has a schema of
47+
For example, let's say you're running the example server from [Passing Arguments](./passing-arguments) that has a schema of
4848

4949
```graphql
5050
type Query {
@@ -82,4 +82,4 @@ Using this syntax for variables is a good idea because it automatically prevents
8282

8383
In general, it will take a bit more time to set up a GraphQL client like Relay, but it's worth it to get more features as your application grows. You might want to start out just using HTTP requests as the underlying transport layer, and switching to a more complex client as your application gets more complex.
8484

85-
At this point you can write a client and server in GraphQL for an API that receives a single string. To do more, you will want to [learn how to use the other basic data types](/basic-types/).
85+
At this point you can write a client and server in GraphQL for an API that receives a single string. To do more, you will want to [learn how to use the other basic data types](./basic-types).

0 commit comments

Comments
 (0)