Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add refresh content docs #26106

Merged
merged 5 commits into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions docs/docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ Gatsby also allows you to specify another environment variable when running the

- `ENABLE_GATSBY_REFRESH_ENDPOINT`

If set to true, this will expose a `/__refresh` webhook that is able to receive `POST` requests to _refresh_ the sourced content. This exposed webhook can be triggered whenever remote data changes, which means you can update your data without re-launching the development server.

You can trigger this endpoint locally, for example, on Unix-based operating systems (like Ubuntu and macOS) using `curl -X POST http://localhost:8000/__refresh`.
This allows you to refresh your sourced content. See [Refreshing content](/docs/content-and-data/refreshing-content).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong link ...

created PR:


## Build Variables

Expand Down
13 changes: 13 additions & 0 deletions docs/docs/refreshing-content.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Refreshing Content
---

During local development it can be useful to refresh sourced content without restarting the development server. To faciliate this Gatsby exposes an environmental variable `ENABLE_GATSBY_REFRESH_ENDPOINT`.
herecydev marked this conversation as resolved.
Show resolved Hide resolved

If set to true, this will expose a /\_\_refresh webhook that is able to receive POST requests to refresh the sourced content. This exposed webhook can be triggered whenever remote data changes.
herecydev marked this conversation as resolved.
Show resolved Hide resolved

You can trigger this endpoint locally, for example, on Unix-based operating systems (like Ubuntu and macOS) using curl -X POST http://localhost:8000/__refresh.
herecydev marked this conversation as resolved.
Show resolved Hide resolved

Additionally, the sourced content can also be refreshed through the GraphiQL explorer.
herecydev marked this conversation as resolved.
Show resolved Hide resolved

Securing the refresh endpoint is possible by supplying a value for the environmental variable `GATSBY_REFRESH_TOKEN`, which will cause Gatsby to only accept requests with a matching authorization header. For example `GATSBY_REFRESH_TOKEN=12345` would require a request with header: `authorization: 12345`.
2 changes: 2 additions & 0 deletions www/src/data/sidebars/doc-links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@
- title: Sourcing Content from JSON or YAML
link: /docs/sourcing-content-from-json-or-yaml/
breadcrumbTitle: JSON or YAML
- title: Refreshing Content
link: /docs/refreshing-content/
- title: Querying Your Data with GraphQL
link: /docs/graphql/
breadcrumbTitle: Querying with GraphQL
Expand Down