Set your environment variables
To use the Connect your app to DataStax Astra DB using the Document API in node.js.
The Astra DB Collection Node.js Client connects to the Astra DB Document API.
Set up your environment
Install the Astra DB JS Collection:
npm install @astrajs/collections
Open a browser, navigate to Astra DB, and log in.
From your Dashboard page, select your database.
Copy the Cluster ID of your database.
You can also find the Cluster ID in the URL, which is the last UUID in the path:
Add the Cluster ID as an environment variable with the following command:
Copy the Region of your database, the region where your database is located.
Add the Region as an environment variable with the following command:
Add your username and your password as environment variables with the following command:
Get Client ID and Client Secret by creating your application token for your username and password.
export ASTRA_DB_USERNAME=clientId export ASTRA_DB_PASSWORD=clientSecret
printenvto ensure the environment variables were exported.