diff options
author | Ian C <ianc@noddybox.co.uk> | 2024-03-22 17:08:07 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2024-03-22 17:08:07 +0000 |
commit | fc456e21c2d70854744b4e1dc816783d9820a01c (patch) | |
tree | 0a8a9343d8a5788471b16489e36b777abbdfe7bf | |
parent | 1f61b2afecb32b5d75268642a49ce9556f505796 (diff) |
Added skeleton of get operation.
-rw-r--r-- | ApiController.cs | 13 | ||||
-rw-r--r-- | Program.cs | 12 | ||||
-rw-r--r-- | download.sln | 25 |
3 files changed, 49 insertions, 1 deletions
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); + } +} @@ -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 |