services | platforms | author |
---|---|---|
documentdb |
nodejs |
andrewhoh |
This sample shows you how to use the Microsoft Azure DocumentDB service to store and access data from a Node.js console application.
-
Before you can run this sample, you must have the following perquisites:
- An active Azure DocumentDB account - If you don't have an account, refer to the Create a DocumentDB account article.
- Node.js version v0.10.29 or higher.
- Git.
-
Clone this repository, or download the zip file.
-
Retrieve the URI and PRIMARY KEY (or SECONDARY KEY) values from the Keys blade of your DocumentDB account in the Azure Preview portal. For more information on obtaining endpoint & keys for your DocumentDB account refer to How to manage a DocumentDB account.
If you don't have an account, see Create a DocumentDB database account to set one up.
-
In the config.js file, located in the src folder, find config.endpoint and config.authKey and replace the placeholder values with the values obtained for your account.
config.endpoint = "
your DocumentDB endpoint here";config.authKey = "
your auth key here"; -
Run npm install in a terminal to install required npm modules
-
Run node app.js in a terminal to start your start your node application.
The code included in this sample is intended to get you quickly started with a Node.js console application that connects to Azure DocumentDB.