-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathhttpGetFunction.cs
More file actions
32 lines (26 loc) · 883 Bytes
/
httpGetFunction.cs
File metadata and controls
32 lines (26 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Logging;
namespace Company.Function
{
public class httpGetFunction
{
private readonly ILogger _logger;
public httpGetFunction(ILoggerFactory loggerFactory)
{
_logger = loggerFactory.CreateLogger<httpGetFunction>();
}
[Function("httpget")]
public IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get")]
HttpRequest req,
string name)
{
var returnValue = string.IsNullOrEmpty(name)
? "Hello, World."
: $"Hello, {name}.";
_logger.LogInformation($"C# HTTP trigger function processed a request for {returnValue}.");
return new OkObjectResult(returnValue);
}
}
}