You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The above code block creates a node called `"Test Node"` as seen from the `title` parameter. If this process is successful restarting the server will make the `allTestNode` query available at `localhost:8000/___graphql`.
56
+
The above code block creates a node called `"Test Node"` as seen from the `title` parameter. If this process is successful restarting the server will make the `allTestNode` query available at `http://localhost:8000/___graphql`.
57
57
58
58
> Libraries like [Axios](https://www.npmjs.com/package/axios) can be used to handle calls in the `gatsby-node.js` file
You can read about each of the packages that are working together in [Apollo's docs](https://www.apollographql.com/docs/react/). The end result is creating a `client` that you can use to call methods like `query` to get data from the source it's configured to work with. In this case, that is `localhost:4000` where you should have the API running. If you can't configure the API to run locally, you can update the URLs for the client to use `gatsby-source-plugin-api.glitch.me` where a version of the API is deployed, instead of `localhost:4000`.
272
+
You can read about each of the packages that are working together in [Apollo's docs](https://www.apollographql.com/docs/react/). The end result is creating a `client` that you can use to call methods like `query` to get data from the source it's configured to work with. In this case, that is `http://localhost:4000` where you should have the API running. If you can't configure the API to run locally, you can update the URLs for the client to use `gatsby-source-plugin-api.glitch.me` where a version of the API is deployed, instead of `http://localhost:4000`.
273
273
274
274
#### Query data from the API
275
275
@@ -924,8 +924,8 @@ You can test that this is working by running the site again and updating one of
924
924
925
925
Follow these steps to test it out:
926
926
927
-
1. Open up your site at `localhost:8000` after you run `gatsby develop`
928
-
2. Open up the GraphQL playground at `localhost:4000` (if you are running the `api` folder locally) or `https://gatsby-source-plugin-api.glitch.me/` and first run a query for posts:
927
+
1. Open up your site at `http://localhost:8000` after you run `gatsby develop`
928
+
2. Open up the GraphQL playground at `http://localhost:4000` (if you are running the `api` folder locally) or `https://gatsby-source-plugin-api.glitch.me/` and first run a query for posts:
Copy file name to clipboardExpand all lines: examples/creating-source-plugins/README.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -22,23 +22,23 @@ _Note: if you aren't using yarn, you can navigate into each of the 3 folders and
22
22
23
23
Then you can run the api or example projects in separate terminal windows with the commands below.
24
24
25
-
For the API which runs at `localhost:4000`, use this command:
25
+
For the API which runs at `http://localhost:4000`, use this command:
26
26
27
27
```
28
28
yarn workspace api start
29
29
```
30
30
31
-
And to run the example site with `gatsby develop` at `localhost:8000`, use this command:
31
+
And to run the example site with `gatsby develop` at `http://localhost:8000`, use this command:
32
32
33
33
```
34
34
yarn workspace example-site develop
35
35
```
36
36
37
-
Running the example site also runs the plugin because it is included in the site's config. You'll see output in the console for different functionality and then can open up the browser to `localhost:8000` to see the site.
37
+
Running the example site also runs the plugin because it is included in the site's config. You'll see output in the console for different functionality and then can open up the browser to `http://localhost:8000` to see the site.
38
38
39
39
## Developing and Experimenting
40
40
41
-
You can open up `localhost:4000` with the API running, which will load a GraphQL Playground, which is a GraphQL IDE (like GraphiQL, that Gatsby runs at `localhost:8000/___graphql`) for running queries and mutations on the data from the API.
41
+
You can open up `http://localhost:4000` with the API running, which will load a GraphQL Playground, which is a GraphQL IDE (like GraphiQL, that Gatsby runs at `http://localhost:8000/___graphql`) for running queries and mutations on the data from the API.
42
42
43
43
You can test a query like this to see data returned:
44
44
@@ -53,7 +53,7 @@ query {
53
53
54
54
This query will return the IDs for all posts in the API. You can copy one of these IDs and provide it as an argument to a mutation to update information about that post.
55
55
56
-
You can run 3 different mutations from the GraphQL Playground (at `localhost:4000`): `createPost`, `updatePost`, and `deletePost`. These methods would mimic CRUD operations happening on the API of the data source like a headless CMS. An example `updatePost` mutation is outlined below.
56
+
You can run 3 different mutations from the GraphQL Playground (at `http://localhost:4000`): `createPost`, `updatePost`, and `deletePost`. These methods would mimic CRUD operations happening on the API of the data source like a headless CMS. An example `updatePost` mutation is outlined below.
57
57
58
58
When you run a mutation on a post, a subscription event is published, which lets the plugin know it should respond and update nodes. The following mutation can be copied into the left side of the GraphQL playground so long as you replace "post-id" with a value returned for an ID from a query (like the one above).
Copy file name to clipboardExpand all lines: packages/gatsby-admin/README.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ Or in the `scripts` section of your `package.json`:
26
26
}
27
27
```
28
28
29
-
Once you run `gatsby develop` with the flag enabled, you can visit `localhost:8000/___admin` to view Admin for your Gatsby site!
29
+
Once you run `gatsby develop` with the flag enabled, you can visit `http://localhost:8000/___admin` to view Admin for your Gatsby site!
30
30
31
31

32
32
@@ -58,7 +58,7 @@ It also listens to the [`gatsby develop` status server](https://github.com/gatsb
58
58
59
59
To discover where they are (and whether they are already running) there is a service discovery mechanism in `gatsby-core-utils`. It stores the ports of the running Gatsby site(s) at `~/.config/gatsby/sites/<pathhash>/<servername>.json`.
60
60
61
-
Admin can then fetch `localhost:8000/___services` (where `:8000` is the well-known port of the running site), which returns a list of all the random ports used by the site:
61
+
Admin can then fetch `http://localhost:8000/___services` (where `:8000` is the well-known port of the running site), which returns a list of all the random ports used by the site:
That's how the Admin frontend knows to connect to `localhost:50400/graphql` to connect to the GraphQL server, and `localhost:60731` to connect to the develop status server.
78
+
That's how the Admin frontend knows to connect to `http://localhost:50400/graphql` to connect to the GraphQL server, and `http://localhost:60731` to connect to the develop status server.
0 commit comments