Integrating the Table API with Node.js

Azure table storage is a key-value-based NoSQL database with high performance. In order to integrate it with Node.js, we need to install the required module. Microsoft has provided official node modules to use the Table API (https://www.npmjs.com/package/azure-storage):

  1. First, create the Table API in Azure portal and copy the connection string. Export it as the environment variable. In a Linux-based system, you can run this command to export a connection string as an environment variable:
export.AZURE_STORAGE_CONNECTION_STRING = <Your connection string>  
  1. Next, install the required dependency. Here is the command:
npm install azure-storage
  1. Once it is installed, you can include the module in your code base and start using the Table storage, for example:
var azure = require('azure-storage'); 
var tableObject = azure.createTableService(); 
tableObject.createTableIfNotExists('demoTable', function(error, result, response){ 
  if(!error){ 
    // Table exists or created 
  } 
  console.log(result); 
});  

This will connect to your Azure table storage using the connection string. Let's go ahead and integrate the Graph API with Node.js.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.224.135