diff --git a/WretchedMachines/API/Items.cs b/WretchedMachines/API/Items.cs new file mode 100644 index 0000000..4ff89d9 --- /dev/null +++ b/WretchedMachines/API/Items.cs @@ -0,0 +1,11 @@ +using WretchedMachines.DataAccess; + +namespace WretchedMachines.API; + +class Items +{ + public static IResult GetItems(IDataAccess dataAccess) + { + return TypedResults.Ok(dataAccess.GetItems()); + } +} \ No newline at end of file diff --git a/WretchedMachines/Pages/Privacy.cshtml b/WretchedMachines/Pages/Privacy.cshtml index 8c7b4a8..00ac1ca 100644 --- a/WretchedMachines/Pages/Privacy.cshtml +++ b/WretchedMachines/Pages/Privacy.cshtml @@ -8,9 +8,13 @@

Use this page to detail your site's privacy policy.

\ No newline at end of file diff --git a/WretchedMachines/Program.cs b/WretchedMachines/Program.cs index e6bfd28..13aabe6 100644 --- a/WretchedMachines/Program.cs +++ b/WretchedMachines/Program.cs @@ -1,5 +1,6 @@ using Serilog; using WretchedMachines.DataAccess; +using WretchedMachines.API; var builder = WebApplication.CreateBuilder(args); @@ -9,10 +10,16 @@ Log.Logger = new LoggerConfiguration() Log.Information("Starting"); builder.Host.UseSerilog(); + // Add services to the container. builder.Services.AddRazorPages(); builder.Services.AddScoped(); var app = builder.Build(); + +RouteGroupBuilder api = app.MapGroup("/api"); + +api.MapGet("/items", Items.GetItems); + // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { @@ -32,3 +39,4 @@ app.UseAuthorization(); app.MapRazorPages(); app.Run(); + diff --git a/WretchedMachines/WretchedMachines.sln b/WretchedMachines/WretchedMachines.sln new file mode 100644 index 0000000..ffc9951 --- /dev/null +++ b/WretchedMachines/WretchedMachines.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}") = "WretchedMachines", "WretchedMachines.csproj", "{991D6359-9E9B-4395-944C-208993435156}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {991D6359-9E9B-4395-944C-208993435156}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {991D6359-9E9B-4395-944C-208993435156}.Debug|Any CPU.Build.0 = Debug|Any CPU + {991D6359-9E9B-4395-944C-208993435156}.Release|Any CPU.ActiveCfg = Release|Any CPU + {991D6359-9E9B-4395-944C-208993435156}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E8EF6499-1ADC-4F72-B30E-AB47570659EF} + EndGlobalSection +EndGlobal