Slide 8
Slide 8 text
Blockは簡単に定義できる
TypeScriptを使って、簡単にBlockを定義できる (以下はDynamoDBテーブルを作ってる)
import { Scope, KVStore, ApiNamespace } from '@aws-blocks/blocks';
これBlockです
const scope = new Scope('app');
const store = new KVStore(scope, 'cache', {});
BlocksでDynamoDBのテーブル作成
export const api = new ApiNamespace(scope, 'api', (context) => ({
async setValue(key: string, value: string) {
DynamoDBの値を設定するAPI作成
await store.put(key, value);
},
async getValue(key: string) {
return store.get(key);
},
}));
DynamoDBの値を取得するAPI