Skip to content

Commit

Permalink
Add Api project
Browse files Browse the repository at this point in the history
  • Loading branch information
mtdunlap committed Dec 19, 2024
1 parent 7c58f67 commit 3f52215
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Sheltered.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web", "src\Web\Web.csproj",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web.UnitTests", "tests\Web.UnitTests\Web.UnitTests.csproj", "{55DBB2B9-77F8-4228-B1D5-E8CD278AFBAA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Api", "src\Api\Api.csproj", "{9BB9632A-F586-4503-8230-AAE5B42D697C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Api.UnitTests", "tests\Api.UnitTests\Api.UnitTests.csproj", "{341719AE-7C67-4C1F-82EF-2E3E9ADEC4AC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -40,11 +44,21 @@ Global
{55DBB2B9-77F8-4228-B1D5-E8CD278AFBAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{55DBB2B9-77F8-4228-B1D5-E8CD278AFBAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{55DBB2B9-77F8-4228-B1D5-E8CD278AFBAA}.Release|Any CPU.Build.0 = Release|Any CPU
{9BB9632A-F586-4503-8230-AAE5B42D697C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BB9632A-F586-4503-8230-AAE5B42D697C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BB9632A-F586-4503-8230-AAE5B42D697C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BB9632A-F586-4503-8230-AAE5B42D697C}.Release|Any CPU.Build.0 = Release|Any CPU
{341719AE-7C67-4C1F-82EF-2E3E9ADEC4AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{341719AE-7C67-4C1F-82EF-2E3E9ADEC4AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{341719AE-7C67-4C1F-82EF-2E3E9ADEC4AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{341719AE-7C67-4C1F-82EF-2E3E9ADEC4AC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{BFC32006-CC1E-4B47-B4E0-F8B9F154CE59} = {D774B9EF-9B46-4B74-BE9A-64433F42B21F}
{A50BA0DE-5F65-40F8-8483-3DB1DF198790} = {45516425-988D-4261-8C46-19EC5D946EAE}
{BFDF54CF-35D7-4C86-86F8-8F9230CCC899} = {D774B9EF-9B46-4B74-BE9A-64433F42B21F}
{55DBB2B9-77F8-4228-B1D5-E8CD278AFBAA} = {45516425-988D-4261-8C46-19EC5D946EAE}
{9BB9632A-F586-4503-8230-AAE5B42D697C} = {D774B9EF-9B46-4B74-BE9A-64433F42B21F}
{341719AE-7C67-4C1F-82EF-2E3E9ADEC4AC} = {45516425-988D-4261-8C46-19EC5D946EAE}
EndGlobalSection
EndGlobal
16 changes: 16 additions & 0 deletions src/Api/Api.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<WarningsNotAsErrors>CS1591</WarningsNotAsErrors>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions src/Api/Api.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@Api_HostAddress = http://localhost:5108

###
27 changes: 27 additions & 0 deletions src/Api/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
}

app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();

app.Run();
23 changes: 23 additions & 0 deletions src/Api/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "http://localhost:5108",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "https://localhost:7097;http://localhost:5108",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
8 changes: 8 additions & 0 deletions src/Api/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
9 changes: 9 additions & 0 deletions src/Api/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
30 changes: 30 additions & 0 deletions tests/Api.UnitTests/Api.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<WarningsNotAsErrors>CS1591</WarningsNotAsErrors>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit.Analyzers" Version="4.3.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
</ItemGroup>

<ItemGroup>
<Using Include="NUnit.Framework" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Api\Api.csproj" />
</ItemGroup>

</Project>

0 comments on commit 3f52215

Please sign in to comment.