Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Commit

Permalink
Add a hello world function
Browse files Browse the repository at this point in the history
  • Loading branch information
kurt-mueller-osumc committed Sep 13, 2023
1 parent 0f9a370 commit cd881cf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Comrit.Functions.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
Expand All @@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.19.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.14.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
<None Include="host.json">
Expand All @@ -20,6 +21,7 @@
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="HelloWorld.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
</Project>
23 changes: 23 additions & 0 deletions HelloWorld.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace Comrit.Functions

open System.Net
open Microsoft.Azure.Functions.Worker
open Microsoft.Azure.Functions.Worker.Http
open Microsoft.Extensions.Logging

module HelloWorld =

[<Function("HelloWorld")>]
let run
([<HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)>] req: HttpRequestData)
(context: FunctionContext)
=
let logger = context.GetLogger "HelloWorld"
logger.LogInformation "F# HTTP trigger function processed a request"

let response = req.CreateResponse(HttpStatusCode.OK)
response.Headers.Add("Content-Type", "text/plain; charset=utf-8")

response.WriteString "Welcome to Azure Functions!"

response

0 comments on commit cd881cf

Please sign in to comment.