diff --git a/Backend/MonitorPanel/MonitorPanel.API/Controllers/WeatherForecastController.cs b/Backend/MonitorPanel/MonitorPanel.API/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..68e2b4d --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.API/Controllers/WeatherForecastController.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Mvc; +using MonitorPanel.Core.Models; + +namespace MonitorPanel.API.Controllers; + +[ApiController] +[Route("[controller]")] +public class WeatherForecastController : ControllerBase +{ + private static readonly string[] Summaries = + [ + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + ]; + + [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/Backend/MonitorPanel/MonitorPanel.API/MonitorPanel.API.csproj b/Backend/MonitorPanel/MonitorPanel.API/MonitorPanel.API.csproj new file mode 100644 index 0000000..223e972 --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.API/MonitorPanel.API.csproj @@ -0,0 +1,18 @@ + + + + net10.0 + enable + enable + + + + + + + + + + + + diff --git a/Backend/MonitorPanel/MonitorPanel.API/MonitorPanel.API.http b/Backend/MonitorPanel/MonitorPanel.API/MonitorPanel.API.http new file mode 100644 index 0000000..d21e8c3 --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.API/MonitorPanel.API.http @@ -0,0 +1,6 @@ +@MonitorPanel.API_HostAddress = http://localhost:5068 + +GET {{MonitorPanel.API_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/Backend/MonitorPanel/MonitorPanel.API/Program.cs b/Backend/MonitorPanel/MonitorPanel.API/Program.cs new file mode 100644 index 0000000..1b05030 --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.API/Program.cs @@ -0,0 +1,27 @@ +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(); + +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.MapOpenApi(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.UseSwagger().UseSwaggerUI(); + +app.Run(); diff --git a/Backend/MonitorPanel/MonitorPanel.API/Properties/launchSettings.json b/Backend/MonitorPanel/MonitorPanel.API/Properties/launchSettings.json new file mode 100644 index 0000000..87bcf34 --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.API/Properties/launchSettings.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:5068", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7204;http://localhost:5068", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Backend/MonitorPanel/MonitorPanel.API/appsettings.json b/Backend/MonitorPanel/MonitorPanel.API/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.API/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/Backend/MonitorPanel/MonitorPanel.Core/Models/Server.cs b/Backend/MonitorPanel/MonitorPanel.Core/Models/Server.cs new file mode 100644 index 0000000..5fbb7d2 --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.Core/Models/Server.cs @@ -0,0 +1,17 @@ +namespace MonitorPanel.Core.Models; + +public class Server( + Guid id, + string name, + bool isHttps, + string address, + string? path, + int port) +{ + public readonly Guid Id = id; + public string Name { get; set; } = name; + public bool IsHttps { get; set; } = isHttps; + public string Address { get; set; } = address; + public string? Path { get; set; } = path; + public int Port { get; set; } = port; +} \ No newline at end of file diff --git a/Backend/MonitorPanel/MonitorPanel.Core/Models/WeatherForecast.cs b/Backend/MonitorPanel/MonitorPanel.Core/Models/WeatherForecast.cs new file mode 100644 index 0000000..286a19b --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.Core/Models/WeatherForecast.cs @@ -0,0 +1,12 @@ +namespace MonitorPanel.Core.Models; + +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/Backend/MonitorPanel/MonitorPanel.Core/MonitorPanel.Core.csproj b/Backend/MonitorPanel/MonitorPanel.Core/MonitorPanel.Core.csproj new file mode 100644 index 0000000..b760144 --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.Core/MonitorPanel.Core.csproj @@ -0,0 +1,9 @@ + + + + net10.0 + enable + enable + + + diff --git a/Backend/MonitorPanel/MonitorPanel.slnx b/Backend/MonitorPanel/MonitorPanel.slnx new file mode 100644 index 0000000..d433a4e --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.slnx @@ -0,0 +1,4 @@ + + + +