Please read through "Storage table input binding" at Azure Functions Storage table bindings. It has examples of function.json
and Node function.
If something is still not clear, please refine your question with the exact problem.
UPDATE:
Here is a sample solution for your refined problem. I only have it in C#, I hope you can derive node implementation.
csx
#r "Microsoft.WindowsAzure.Storage"
using System;
using System.Net;
using Microsoft.WindowsAzure.Storage.Table;
public class Entity : TableEntity
{
public int num {get; set;}
}
public static HttpResponseMessage Run(HttpRequestMessage req, string partition,
string rowkey, Entity inputEntity, out Entity outputEntity)
{
if (inputEntity == null)
outputEntity = new Entity { PartitionKey = partition, RowKey = rowkey, num = 1};
else
{
inputEntity.num += 1;
outputEntity = inputEntity;
}
return req.CreateResponse(HttpStatusCode.OK, $"Done, num = {outputEntity.num}");
}
function.json
:
{
"bindings": [
{
"authLevel": "function",
"name": "req",
"type": "httpTrigger",
"direction": "in",
"route": "HttpTriggerTableUpdate/{partition}/{rowkey}"
},
{
"name": "$return",
"type": "http",
"direction": "out"
},
{
"type": "table",
"name": "inputEntity",
"tableName": "MyTable",
"partitionKey": "{partition}",
"rowKey": "{rowkey}",
"connection": "my_STORAGE",
"direction": "in"
},
{
"type": "table",
"name": "outputEntity",
"tableName": "MyTable",
"partitionKey": "{partition}",
"rowKey": "{rowkey}",
"connection": "my_STORAGE",
"direction": "out"
}
],
"disabled": false
}