Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Api/ProductsGet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using System.Threading.Tasks;

namespace Api;

public class ProductsGet
{
private readonly IProductData productData;

public ProductsGet(IProductData productData)
{
this.productData = productData;
}

[FunctionName("ProductsGet")]
public async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "products")] HttpRequest req)
{
var products = await productData.GetProducts();
return new OkObjectResult(products);
}
}
6 changes: 5 additions & 1 deletion Api/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"profiles": {
"profiles": {
"Api": {
"commandName": "Project",
"commandLineArgs": "start --cors *"
}
}
}
2 changes: 1 addition & 1 deletion ShoppingList.sln
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EC9ADCA0-AF9C-4DCA-971A-A96B676B5A8A}
EndGlobalSection
EndGlobal
EndGlobal