Skip to content

Instantly share code, notes, and snippets.

@brenoferreira
Created January 24, 2012 20:04
Show Gist options
  • Save brenoferreira/1672240 to your computer and use it in GitHub Desktop.
Save brenoferreira/1672240 to your computer and use it in GitHub Desktop.
AzureTableNodeUnicode
var azure = require('azure');
var http = require('http');
var server = http.createServer(function(req, resp){
var storageAccount = 'account';
var storageKey = 'key';
var tableServiceClient = azure.createTableService(storageAccount, storageKey, azure.ServiceClient.CLOUD_TABLE_HOST);
tableServiceClient.createTableIfNotExists("tasks", function (res, created) {
var item = {
name: 'ÁÇÀÂÄ',
category: 'Site work',
date: '12/01/2011',
RowKey: 'task1',
PartitionKey: 'partition1',
completed: false
};
tableServiceClient.insertEntity("tasks", item, function(error, serverEntity){
if(error === null){
console.log('\nEntity\n')
console.log(serverEntity);
}
else
{
console.log('\nError\n')
console.log(error);
}
resp.writeHead('200', {'Content-Type': 'plain/text'});
resp.end(JSON.stringify(serverEntity));
});
});
});
server.listen(8080);
console.log("Server listening at: http://localhost:8080");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment