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 tutorial on how to use Workers KV directly from Rust #1902

Conversation

fkettelhoit
Copy link
Contributor

During a call with @Albertozhao today he mentioned that a code sample showing how to use Workers KV directly from a Rust worker could be a suitable addition to the existing docs. This PR is a tutorial that shows how to wrap a subset of the Workers KV API in rust and use it to create a worker that exposes simple get and put operations, with the following end result:

$ curl 'localhost:8787/foo'
""
$ curl -X PUT 'localhost:8787/foo?value=bar'
$ curl 'localhost:8787/foo'
"bar"

@fkettelhoit fkettelhoit requested review from a team as code owners July 28, 2021 19:32
@kristianfreeman
Copy link
Contributor

this is awesome!! do you mind doing a soft wrap instead of hard wrap throughout this file? will make it easier to review. we'll rope in some members of the team to check this out once i can take an initial look

@fkettelhoit
Copy link
Contributor Author

@signalnerve sure, done!

@fkettelhoit
Copy link
Contributor Author

By the way, the following PR might also be relevant in the context of Rust workers: cloudflare/wrangler-action#61

(I'm mentioning it here since I wasn't sure how actively the wrangler-action repo is being maintained.)

Copy link
Contributor

@deadlypants1973 deadlypants1973 left a comment

Choose a reason for hiding this comment

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

Adding in my notes for style guide revision.

Co-authored-by: Kate Tungusova <70746074+deadlypants1973@users.noreply.github.com>
}
}
}
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an example repo that can be linked down here in a conclusion paragraph?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have now pushed the full example to https://github.com/fkettelhoit/workers-kv-from-rust and added a short note in the last paragraph. Feel free to move the code over to some Cloudflare repository, if you would prefer not to link to external repositories.

fkettelhoit and others added 2 commits August 6, 2021 19:54
Co-authored-by: Kristian Freeman <kristian@kristianfreeman.com>
Copy link
Contributor

@deadlypants1973 deadlypants1973 left a comment

Choose a reason for hiding this comment

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

final review comments

Final review comments
Copy link
Contributor

@deadlypants1973 deadlypants1973 left a comment

Choose a reason for hiding this comment

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

Approved from style guide review but need @signalnerve to give final okay.

@kristianfreeman kristianfreeman merged commit 8f3fbf7 into cloudflare:production Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants