services | platforms | author |
---|---|---|
cosmos-db |
nodejs |
lbosq |
Azure Cosmos DB is a globally distributed multi-model database. One of the supported APIs is the Graph (Gremlin) API, which provides a graph data model with Gremlin query/traversals. This sample shows you how to use the Azure Cosmos DB with the Graph API to store and access data from a Node.js application.
-
Before you can run this sample, you must have the following prerequisites:
- An active Azure Cosmos DB account - If you don't have an account, refer to the Build a Node.js application by using Graph API article.
- Node.js version v0.10.29 or higher.
- Git.
-
Then, clone this repository using
git clone https://github.com/Azure-Samples/azure-cosmos-db-graph-nodejs-getting-started.git
-
Next, substitute the graph endpoint (
*.graphs.azure.com
), your database and collection (graph) values, and primary master key inconfig.js
with your Cosmos DB account's values. -
From a command prompt or shell, run
npm install
from the root directory to install the gremlin-javascript and async modules, and their dependencies. -
From a command prompt or shell, run
node app.js
to run the application and follow the instructions.
The code included in this sample is intended to get you quickly started with a Node.js application that connects to Azure Cosmos DB with the Graph (Gremlin) API.