Skip to content

Instantly share code, notes, and snippets.



Last active Oct 12, 2018
What would you like to do?
Configure access to the Azure Cosmos DB
app.get('/', async (req, res) => {
// Import database node module
const CosmosClientInterface = require("@azure/cosmos").CosmosClient;
// Database and container IDs
const databaseId = "ToDoList";
const containerId = "Items";
// Configure database access URI and primary key
const endpoint = "https://<...>";
const authKey = "<...>";
// Instantiate the cosmos client, based on the endpoint and authorization key
const cosmosClient = new CosmosClientInterface({
endpoint: endpoint,
auth: {
masterKey: authKey
consistencyLevel: "Session"
// ... (we will add more code here!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.