diff --git a/Projects/HubX/HubX.DB/HubX.DB.sqlproj b/Projects/HubX/HubX.DB/HubX.DB.sqlproj new file mode 100644 index 0000000..f5adbbb --- /dev/null +++ b/Projects/HubX/HubX.DB/HubX.DB.sqlproj @@ -0,0 +1,60 @@ + + + + Debug + AnyCPU + HubX.DB + 2.0 + 4.1 + {514ddccf-6b50-49f8-b212-70498396cf19} + Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider + Database + + + HubX.DB + HubX.DB + 1033, CI + BySchemaAndSchemaType + True + v4.7.2 + CS + Properties + False + True + True + + + bin\Release\ + $(MSBuildProjectName).sql + False + pdbonly + true + false + true + prompt + 4 + + + bin\Debug\ + $(MSBuildProjectName).sql + false + true + full + false + true + true + prompt + 4 + + + 11.0 + + True + 11.0 + + + + + + + \ No newline at end of file diff --git a/Projects/HubX/HubX.Server/Controllers/WeatherForecastController.cs b/Projects/HubX/HubX.Server/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..ca7fa53 --- /dev/null +++ b/Projects/HubX/HubX.Server/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; + +namespace HubX.Server.Controllers +{ + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} diff --git a/Projects/HubX/HubX.Server/HubX.Server.csproj b/Projects/HubX/HubX.Server/HubX.Server.csproj new file mode 100644 index 0000000..9daa180 --- /dev/null +++ b/Projects/HubX/HubX.Server/HubX.Server.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/Projects/HubX/HubX.Server/HubX.Server.http b/Projects/HubX/HubX.Server/HubX.Server.http new file mode 100644 index 0000000..3761f00 --- /dev/null +++ b/Projects/HubX/HubX.Server/HubX.Server.http @@ -0,0 +1,6 @@ +@HubX.Server_HostAddress = http://localhost:5103 + +GET {{HubX.Server_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/Projects/HubX/HubX.Server/Program.cs b/Projects/HubX/HubX.Server/Program.cs new file mode 100644 index 0000000..48863a6 --- /dev/null +++ b/Projects/HubX/HubX.Server/Program.cs @@ -0,0 +1,25 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/Projects/HubX/HubX.Server/Properties/launchSettings.json b/Projects/HubX/HubX.Server/Properties/launchSettings.json new file mode 100644 index 0000000..ceae9d3 --- /dev/null +++ b/Projects/HubX/HubX.Server/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:33125", + "sslPort": 44383 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5103", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7163;http://localhost:5103", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Projects/HubX/HubX.Server/WeatherForecast.cs b/Projects/HubX/HubX.Server/WeatherForecast.cs new file mode 100644 index 0000000..d5ec83b --- /dev/null +++ b/Projects/HubX/HubX.Server/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace HubX.Server +{ + public class WeatherForecast + { + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} diff --git a/Projects/HubX/HubX.Server/appsettings.Development.json b/Projects/HubX/HubX.Server/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/Projects/HubX/HubX.Server/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/Projects/HubX/HubX.Server/appsettings.json b/Projects/HubX/HubX.Server/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/Projects/HubX/HubX.Server/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/Projects/HubX/HubX.sln b/Projects/HubX/HubX.sln new file mode 100644 index 0000000..14c6075 --- /dev/null +++ b/Projects/HubX/HubX.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34728.123 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HubX.Server", "HubX.Server\HubX.Server.csproj", "{AFAF8DB4-790C-4482-9B31-3DFFE4FF3DB7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AFAF8DB4-790C-4482-9B31-3DFFE4FF3DB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AFAF8DB4-790C-4482-9B31-3DFFE4FF3DB7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AFAF8DB4-790C-4482-9B31-3DFFE4FF3DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AFAF8DB4-790C-4482-9B31-3DFFE4FF3DB7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {30EA2F90-E145-4765-B14C-DCC78789F472} + EndGlobalSection +EndGlobal