Cannot access kv namespace
Im trying to make a cache system using kv namespace in wrangler and im trying to acesss it like so
env.name.get('key')
but it gives reference error env not defined. also i have added the namespace name, id and preview_id to wrangler.toml file
help pls6 Replies
gimme a couple hours i'll get home and send it
app.js:
wrangler.toml:
@Leo
ah...
i was following a diff page on google
i'll read the docs n lyk if i got problems
do i not need the line in wrangler.toml ??
i got all that by running some wrangler cmds
also this line
does this mean that evertime i restart my api the data will be erased ??
This is for the type or interface for your bindings,
type Bindings = {
kv: KVNamespace
}
Your env can be accessed by using c.env
im on js not ts... so what what would this be fr js
@gwapes
You can only use generics in ts, so ignore it
^
ok
so i should be able to use this?
@gwapes
Try it and see