Created
January 24, 2012 20:04
-
-
Save brenoferreira/1672240 to your computer and use it in GitHub Desktop.
AzureTableNodeUnicode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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