DeadnTangy
Unsure what this error means
using System;
using System.Net;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System.Net.Http;
using System.Text;
using Microsoft.Azure.WebJobs.Extensions.CosmosDB;
using System.Linq.Expressions;
using Microsoft.Azure.Cosmos;
namespace Company.Function
{
public static class getVisitorCounter
{
[FunctionName("getVisitorCounter")]
public static Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
[CosmosDB(databaseName:"AzureResume",containerName:"Counter", Connection = "AzureResumeConnectionString", Id = "1", PartitionKey = "1")] Counter counter,
[CosmosDB(databaseName:"AzureResume", containerName: "Counter", Connection = "AzureResumeConnectionString", Id = "1", PartitionKey = "1")] out Counter updatedCounter,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
updatedCounter = counter;
updatedCounter.Count += 1;
var jsonToRetun = JsonConvert.SerializeObject(counter);
return new HttpResponseMessage(System.Net.HttpStatusCode.OK){
Content = new StringContent(jsonToRetun, Encoding.UTF8, "application/json")
};
}
}
}
11 replies