From fc456e21c2d70854744b4e1dc816783d9820a01c Mon Sep 17 00:00:00 2001 From: Ian C Date: Fri, 22 Mar 2024 17:08:07 +0000 Subject: Added skeleton of get operation. --- ApiController.cs | 13 +++++++++++++ Program.cs | 12 +++++++++++- download.sln | 25 +++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 ApiController.cs create mode 100644 download.sln diff --git a/ApiController.cs b/ApiController.cs new file mode 100644 index 0000000..3b75419 --- /dev/null +++ b/ApiController.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Mvc; +using System.Collections.Generic; +using System.Net; + +namespace download; + +public class ApiController : Controller +{ + public IActionResult Get(string? key) + { + return StatusCode((int)HttpStatusCode.OK, "Hello World - " + key); + } +} diff --git a/Program.cs b/Program.cs index bc8438c..1b97a78 100644 --- a/Program.cs +++ b/Program.cs @@ -1,6 +1,16 @@ var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddControllersWithViews(); + var app = builder.Build(); -app.MapGet("/", () => "Hello World!"); +app.UseHttpsRedirection(); +app.UseStaticFiles(); + +app.UseRouting(); + +app.UseAuthorization(); + +app.MapControllerRoute(name: "default", pattern: "{controller=Api}/{action=Get}/{key}"); app.Run(); diff --git a/download.sln b/download.sln new file mode 100644 index 0000000..60c6923 --- /dev/null +++ b/download.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "download", "download.csproj", "{51C6772D-BEAF-420A-A97C-1D8DA6E7049A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {51C6772D-BEAF-420A-A97C-1D8DA6E7049A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {51C6772D-BEAF-420A-A97C-1D8DA6E7049A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {51C6772D-BEAF-420A-A97C-1D8DA6E7049A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {51C6772D-BEAF-420A-A97C-1D8DA6E7049A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C7D3E898-6EC3-4125-8F8D-A38F77279FC2} + EndGlobalSection +EndGlobal -- cgit v1.2.3