The Azure IoT Service SDK for Node.js helps you build applications that interact with your devices and manage their identities in your IoT hub.
npm is a command-line package manager that is installed with Node.js is installed, and will be used to install Azure IoT node.js client side SDK.
npm install -g azure-iothub@latest to get the latest (pre-release) version.
npm install -g azure-iothub to get the latest (release) version.
Once you have installed the package as indicated above, you can start using the features of the Service SDK in your code. Below is a code snippet showing how to add a new device in the Azuyre IoT Hub device registry:
Note that for this sample to work, you will need to setup your IoT hub and retreive credentials for the service app. In the code, replace '[IoT Connection String]' with an access policy's credentials for your IoT Hub.
var iothub = ;var connectionString = '[IoT Connection String]';var registry = iothubRegistry;// Create a new devicevar device =deviceId: 'sample-device-' + Date;registry;
Check out the samples for details on the various features of the Service SDK
Service SDK subfolders:
Development requirements documentation
Code for the library
Set of simple samples showing how to use the features of the Service SDK