mirror of
https://github.com/farcasclaudiu/AzureStaticWebApp-CSharp-SimpleDemo.git
synced 2026-06-22 11:01:19 +03:00
revert to basic
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
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;
|
||||
|
||||
namespace demo.Function
|
||||
{
|
||||
public static class JustHello
|
||||
{
|
||||
[FunctionName("JustHello")]
|
||||
public static async Task<IActionResult> Run(
|
||||
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
|
||||
ILogger log)
|
||||
{
|
||||
log.LogInformation("C# HTTP trigger function processed a request.");
|
||||
|
||||
string name = req.Query["name"];
|
||||
|
||||
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
|
||||
dynamic data = JsonConvert.DeserializeObject(requestBody);
|
||||
name = name ?? data?.name;
|
||||
|
||||
string responseMessage = string.IsNullOrEmpty(name)
|
||||
? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response."
|
||||
: $"Bonjour Hi, {name}. This HTTP triggered function executed successfully.";
|
||||
|
||||
return new OkObjectResult(responseMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user