Skip to content

Commit

Permalink
Create a cloud-function-hello-world template for .NET GoogleCloudPlat…
Browse files Browse the repository at this point in the history
  • Loading branch information
meteatamel committed Nov 18, 2022
1 parent 7438678 commit 96e1638
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dotnet/cloud-function-hello-world/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"configurations": [
{
"name": "Deploy Cloud Function",
"type": "cloudcode.cloudfunctions",
"request": "launch",
"functionName": "function-hello-world",
"gen": "GEN_2",
"entryPoint": "cloud_function_hello_world.Function",
}
]
}
18 changes: 18 additions & 0 deletions dotnet/cloud-function-hello-world/Function.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Google.Cloud.Functions.Framework;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;

namespace cloud_function_hello_world;

public class Function : IHttpFunction
{
/// <summary>
// Simple function to return "Hello World!"
/// </summary>
/// <param name="context">The HTTP context, containing the request and the response.</param>
/// <returns>A task representing the asynchronous operation.</returns>
public async Task HandleAsync(HttpContext context)
{
await context.Response.WriteAsync("Hello World!");
}
}
1 change: 1 addition & 0 deletions dotnet/cloud-function-hello-world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Google.Cloud.Functions.Hosting" Version="2.0.0-beta01" />
<None Include="appsettings*.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>

0 comments on commit 96e1638

Please sign in to comment.