typescript sdk for KV?
Could you tell me if there is a taipescript SDK for kv because I couldn't find it. Just the rest API endpoint I found it.
7 Replies
The api within workers is fully typed with
workers-types
and works well: https://developers.cloudflare.com/kv/get-started/
Anything specifically you were looking for with an SDK?Get started · Cloudflare Workers KV
This guide will instruct you through:
It's not just about typescript, I'm new with kV. With redis we have a sdk to connect and put and get the key values from database. How can I do that with kV? Just command line for terminal or request API rest by endpoint?
The best way is using workers because it will be quickest. The only way to do it outside of workers is with the REST but there is a rate limit of 1200/5 minutes
You could write a worker that acts as a REST API endpoint to prevent hitting the Cloudflare API limit
My project uses cloudflare pages, made with Nuxt 3 .
Gotcha then you don't need a connect part as KV is auto connected for your project. As @James metioned the types are a part of workers-types and you can find the API examples with https://developers.cloudflare.com/kv/api/write-key-value-pairs/
Write key-value pairs · Cloudflare Workers KV
To create a new key-value pair, or to update the value for a particular key, call the put() method on any KV namespace you have bound to your Worker …
For local test, I will need to use
wrangler dev [<SCRIPT>] [OPTIONS]
?
I'd recommend following https://developers.cloudflare.com/pages/framework-guides/deploy-a-nuxt-site/
Deploy a Nuxt site · Cloudflare Pages docs
Nuxt is a web framework making web Vue.js-based development simple and powerful.