From 7d14bc961d2b33b941f904d7d1f21dfc930eebe0 Mon Sep 17 00:00:00 2001 From: "kalin.nebeker" Date: Fri, 15 Mar 2024 15:42:30 -0600 Subject: [PATCH] doing the branch --- Api/ProductsGet.cs | 30 ++++++++++++++++++++++++++++++ Api/Properties/launchSettings.json | 6 +++++- ShoppingList.sln | 2 +- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 Api/ProductsGet.cs diff --git a/Api/ProductsGet.cs b/Api/ProductsGet.cs new file mode 100644 index 0000000..0759f9d --- /dev/null +++ b/Api/ProductsGet.cs @@ -0,0 +1,30 @@ +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 Api +{ + public class ProductsGet + { + private readonly IProductData productData; + + public ProductsGet(IProductData productData) + { + this.productData = productData; + } + + [FunctionName("ProductsGet")] + public async Task Run( + [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "products")] HttpRequest req) + { + var products = await productData.GetProducts(); + return new OkObjectResult(products); + } + } +} \ No newline at end of file diff --git a/Api/Properties/launchSettings.json b/Api/Properties/launchSettings.json index e0576c6..1a072a9 100644 --- a/Api/Properties/launchSettings.json +++ b/Api/Properties/launchSettings.json @@ -1,4 +1,8 @@ { - "profiles": { + "profiles": { + "Api": { + "commandName": "Project", + "commandLineArgs": "start --cors *" } + } } \ No newline at end of file diff --git a/ShoppingList.sln b/ShoppingList.sln index c403c00..3f286a2 100644 --- a/ShoppingList.sln +++ b/ShoppingList.sln @@ -62,4 +62,4 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EC9ADCA0-AF9C-4DCA-971A-A96B676B5A8A} EndGlobalSection -EndGlobal \ No newline at end of file +EndGlobal