-
Notifications
You must be signed in to change notification settings - Fork 6.6k
[Workers KV] Improving KV getting started guide #22573
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
base: production
Are you sure you want to change the base?
Conversation
Howdy and thanks for contributing to our repo. The Cloudflare team reviews new, external PRs within two (2) weeks. If it's been two weeks or longer without any movement, please tag the PR Assignees in a comment. We review internal PRs within 1 week. If it's something urgent or has been sitting without a comment, start a thread in the Developer Docs space internally. PR Change SummaryEnhanced the Workers KV getting started guide with improved clarity and usability.
Modified Files
How can I customize these reviews?Check out the Hyperlint AI Reviewer docs for more information on how to customize the review. If you just want to ignore it on this PR, you can add the Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add |
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
Preview URL: https://6bb5d6de.preview.developers.cloudflare.com Files with changes (up to 15)
|
@@ -1,11 +1,14 @@ | |||
--- | |||
title: Getting started | |||
pcx_content_type: get-started | |||
summary: | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean this or description
? Was curious as I was not expecting a summary to appear at the top of the page. I think I've only seen this used before in specific cases such as Snippets or Rules examples (like this)
Add the following to your configuration file in your kv_namespaces array: | ||
{ | ||
"kv_namespaces": [ | ||
{ | ||
"binding": "USERS_NOTIFICATION_CONFIG", | ||
"id": "<BINDING_ID>" | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking: this is intended to appear inside the output
, right? Or would it be a separate 2?
</Details> | ||
|
||
:::note | ||
To view the value directly within the terminal, you use the `--text` flag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To view the value directly within the terminal, you use the `--text` flag. | |
To view the value directly within the terminal, use the `--text` flag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's referring to the command above, maybe adding the sentence to the end of the paragraph in line 292 could be more direct.
|
||
</Steps> | ||
|
||
You can add a `--preview` flag to interact with a preview namespace instead of a production namespace. | ||
{/* You can add a `--preview` flag to interact with a preview namespace instead of a production namespace. */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this supposed to be removed?
The browser should simply return the `VALUE` corresponding to the `KEY` you have specified with the `get()` method. | ||
1. Writes a key to your KV namespace using KV's `put()` method. | ||
2. Reads the same key using KV's `get()` method. | ||
3. It checks if the key is null, and returns a `404` response if it is. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. It checks if the key is null, and returns a `404` response if it is. | |
3. Checks if the key is null, and returns a `404` response if it is. |
2. Reads the same key using KV's `get()` method. | ||
3. It checks if the key is null, and returns a `404` response if it is. | ||
4. If the key is not null, it returns the value of the key. | ||
5. Uses JavaScript's [`try...catch`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch) exception handling to catch potential errors. When writing or reading from any service, such as Workers KV or external APIs using `fetch()`, you should expect to handle exceptions explicitly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5. Uses JavaScript's [`try...catch`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch) exception handling to catch potential errors. When writing or reading from any service, such as Workers KV or external APIs using `fetch()`, you should expect to handle exceptions explicitly. | |
5. Uses JavaScript's [`try...catch`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/try...catch) exception handling to catch potential errors. When writing or reading from any service, such as Workers KV or external APIs using `fetch()`, you should expect to handle exceptions explicitly. |
Summary
index.ts
so that it's more obvious to see how it gets used in an application.summary
frontmatter to provide context on what we're trying to achieve.updated
frontmatter to start tracking when the tutorial has been last updated.Screenshots (optional)
Documentation checklist