-
-
Save justinyoo/aba113838ded074dea58cd9b56114890 to your computer and use it in GitHub Desktop.
Precompiled Azure Functions Revisited
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
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