Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Precompiled Azure Functions Revisited
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
namespace PrecompiledSample.Functions
public static class AddProductHttpTrigger
// Make sure this SHOULD always be static.
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, IAsyncCollector<string> outputQueues, TraceWriter log)
log.Info("C# HTTP trigger function processed a request.");
var body = await req.Content.ReadAsStringAsync().ConfigureAwait(false);
// Loads request body to the queue.
await outputQueues.AddAsync(body).ConfigureAwait(false);
// Make sure it returns HTTP Status Code of 202 (Accepted).
return req.CreateResponse(HttpStatusCode.Accepted);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment