Developing a Node.js app using the Azure Cosmos DB SQL API
Running this sample
This sample is designed to be run as part of the article, "Quickstart: use Node.js to query an Azure Cosmos DB SQL API Database".
- Before you can run this sample, you must have the following perquisites: _ An active Azure Cosmos DB account - If you don't have an account, refer to the Create an Azure Cosmos DB account article. _ Node.js version v0.10.29 or higher. * Git.
Clone this repository using
git clone firstname.lastname@example.org:Azure-Samples/azure-cosmos-db-sql-api-nodejs-getting-started.git cosmosdb
Change directories to the repo using
Next, substitute the endpoint and authorization key in
app.jswith your Azure Cosmos DB account's values.
const endpoint = "<Your Azure Cosmos account URI>"; const key = "<Your Azure Cosmos account key>";
npm installin a terminal to install required npm modules
node app.jsin a terminal to start your start your node application.
About the code
The code included in this sample is intended to get you quickly started with a Node.js console application that connects to Azure Cosmos DB with the SQL API.