Add data to your database
Before you start, make sure you've created and initialized an EdgeKV database. You can perform the one-time EdgeKV database initialization using the API. This initializes the EdgeKV database on both staging and production. It also creates a “default” namespace on both staging and production.
The next step is to populate that database with data that can be consumed by your EdgeWorkers function.
Warning!
EdgeKV is a distributed key-value store that enables JavaScript developers to build data-driven EdgeWorkers applications for latency-sensitive use cases. The current release of EdgeKV is not designed for handling personal, confidential, proprietary data, or any other type of data where unauthorized access to or disclosure of such data would result in loss, legal or regulatory liability, or other harm to Customers or their end users (“Sensitive Data”). EdgeKV should not, therefore, be used to store Sensitive Data. In addition, do not use data returned from EdgeKV to influence workflows that are in scope for compliance frameworks which mandate specific requirements for the handling of Sensitive Data without conducting an appropriate impact review. Customers of EdgeKV are responsible for maintaining control over the data loaded into EdgeKV and for review of applicable information security, privacy, and compliance requirements to determine the appropriateness of their use of this service.
This example shows you how to populate your EdgeKV database. Go to the getting-started section in the EdgeKV Hello World readme file for more information.
EdgeWorkers functions running on the production network can only be used with EdgeKV namespaces created on the production network. Similarly, EdgeWorkers running on the staging network can only access EdgeKV namespaces created on the staging network. This is to ensure separation of concerns for security reasons.
You can also specify where to add the the various language specific greetings to your EdgeKV store using the networks/{network} path in the API endpoint.
METHOD | ENDPOINT | Data
------ | -----------------------------------------------------| -----------------
PUT | /edgekv/v1/networks/staging/namespaces/default/groups/greetings/items/en | "Hello World"
PUT | /edgekv/v1/networks/staging/namespaces/default/groups/greetings/items/fr | "Bonjour le Monde"
PUT | /edgekv/v1/networks/staging/namespaces/default/groups/greetings/items/es | "Hola Mundo"
For a complete list of EdgeKV endpoints refer to the EdgeKV API documentation.
Updated almost 2 years ago