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 azure-iothub to get the latest 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 Azure IoT Hub device registry:
Note that for this sample to work, you will need to setup your IoT hub and retrieve credentials for the service app. Utilize the '[IoT Connection String]', in quotes, on the command line invoking the sample.
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