type Post = { title: string slug: string content: string draft: boolean publishedAt: Date}
class CityController { async createCity(context: Context) { const { citySlug } = context.params const key = ['cities', citySlug] const result = await kv.atomic().check({ key, versionstamp: null }).set(key, value).commit() } ...}
// List Citiesrouter.get('/cities', async () => { const list = kv.list<ICity[]>({ prefix: ['cities'] }) const cities = [] for await (const city of list) cities.push(city) return { data: { cities } }})