summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/Elements.Backend/Controllers/WeatherForecastController.cs32
-rw-r--r--backend/Elements.Backend/Elements.Backend.csproj18
-rw-r--r--backend/Elements.Backend/Program.cs25
-rw-r--r--backend/Elements.Backend/Properties/launchSettings.json41
-rw-r--r--backend/Elements.Backend/WeatherForecast.cs12
-rw-r--r--backend/Elements.Backend/appsettings.Development.json8
-rw-r--r--backend/Elements.Backend/appsettings.json9
-rw-r--r--backend/Elements.Data/ApplicationDbContext.cs7
-rw-r--r--backend/Elements.Data/Elements.Data.csproj13
-rw-r--r--backend/Elements.Data/Models/Element.cs5
-rw-r--r--backend/elements-backend.sln27
-rw-r--r--backend/justfile2
12 files changed, 199 insertions, 0 deletions
diff --git a/backend/Elements.Backend/Controllers/WeatherForecastController.cs b/backend/Elements.Backend/Controllers/WeatherForecastController.cs
new file mode 100644
index 0000000..9a70e36
--- /dev/null
+++ b/backend/Elements.Backend/Controllers/WeatherForecastController.cs
@@ -0,0 +1,32 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace Elements.Backend.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<WeatherForecastController> _logger;
+
+ public WeatherForecastController(ILogger<WeatherForecastController> logger)
+ {
+ _logger = logger;
+ }
+
+ [HttpGet(Name = "GetWeatherForecast")]
+ public IEnumerable<WeatherForecast> Get()
+ {
+ return Enumerable.Range(1, 5).Select(index => new WeatherForecast
+ {
+ Date = DateOnly.FromDateTime(DateTime.Now),
+ TemperatureC = Random.Shared.Next(-20, 55),
+ Summary = Summaries[Random.Shared.Next(Summaries.Length)]
+ })
+ .ToArray();
+ }
+}
diff --git a/backend/Elements.Backend/Elements.Backend.csproj b/backend/Elements.Backend/Elements.Backend.csproj
new file mode 100644
index 0000000..0c664a6
--- /dev/null
+++ b/backend/Elements.Backend/Elements.Backend.csproj
@@ -0,0 +1,18 @@
+<Project Sdk="Microsoft.NET.Sdk.Web">
+
+ <PropertyGroup>
+ <TargetFramework>net7.0</TargetFramework>
+ <Nullable>enable</Nullable>
+ <ImplicitUsings>enable</ImplicitUsings>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.5" />
+ <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Elements.Data\Elements.Data.csproj" />
+ </ItemGroup>
+
+</Project>
diff --git a/backend/Elements.Backend/Program.cs b/backend/Elements.Backend/Program.cs
new file mode 100644
index 0000000..15eacee
--- /dev/null
+++ b/backend/Elements.Backend/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/backend/Elements.Backend/Properties/launchSettings.json b/backend/Elements.Backend/Properties/launchSettings.json
new file mode 100644
index 0000000..0a48056
--- /dev/null
+++ b/backend/Elements.Backend/Properties/launchSettings.json
@@ -0,0 +1,41 @@
+{
+ "$schema": "https://json.schemastore.org/launchsettings.json",
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:32536",
+ "sslPort": 44324
+ }
+ },
+ "profiles": {
+ "http": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "applicationUrl": "http://localhost:5102",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "https": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "applicationUrl": "https://localhost:7014;http://localhost:5102",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
diff --git a/backend/Elements.Backend/WeatherForecast.cs b/backend/Elements.Backend/WeatherForecast.cs
new file mode 100644
index 0000000..7c8962e
--- /dev/null
+++ b/backend/Elements.Backend/WeatherForecast.cs
@@ -0,0 +1,12 @@
+namespace Elements.Backend;
+
+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/Elements.Backend/appsettings.Development.json b/backend/Elements.Backend/appsettings.Development.json
new file mode 100644
index 0000000..ff66ba6
--- /dev/null
+++ b/backend/Elements.Backend/appsettings.Development.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ }
+}
diff --git a/backend/Elements.Backend/appsettings.json b/backend/Elements.Backend/appsettings.json
new file mode 100644
index 0000000..4d56694
--- /dev/null
+++ b/backend/Elements.Backend/appsettings.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*"
+}
diff --git a/backend/Elements.Data/ApplicationDbContext.cs b/backend/Elements.Data/ApplicationDbContext.cs
new file mode 100644
index 0000000..619719a
--- /dev/null
+++ b/backend/Elements.Data/ApplicationDbContext.cs
@@ -0,0 +1,7 @@
+using Microsoft.EntityFrameworkCore;
+
+namespace Elements.Data;
+public class ApplicationDbContext : DbContext
+{
+
+}
diff --git a/backend/Elements.Data/Elements.Data.csproj b/backend/Elements.Data/Elements.Data.csproj
new file mode 100644
index 0000000..408fea2
--- /dev/null
+++ b/backend/Elements.Data/Elements.Data.csproj
@@ -0,0 +1,13 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>net7.0</TargetFramework>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <Nullable>enable</Nullable>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.12" />
+ </ItemGroup>
+
+</Project>
diff --git a/backend/Elements.Data/Models/Element.cs b/backend/Elements.Data/Models/Element.cs
new file mode 100644
index 0000000..2f602e5
--- /dev/null
+++ b/backend/Elements.Data/Models/Element.cs
@@ -0,0 +1,5 @@
+namespace Elements.Data.Models;
+
+public class Element {
+
+} \ No newline at end of file
diff --git a/backend/elements-backend.sln b/backend/elements-backend.sln
new file mode 100644
index 0000000..700c51d
--- /dev/null
+++ b/backend/elements-backend.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31903.59
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elements.Backend", "Elements.Backend\Elements.Backend.csproj", "{2E7A83DE-9B0C-4ACE-BCAB-ADBB8B624EF8}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elements.Data", "Elements.Data\Elements.Data.csproj", "{9772A869-D6F0-4BE4-A42F-A64420405223}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2E7A83DE-9B0C-4ACE-BCAB-ADBB8B624EF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2E7A83DE-9B0C-4ACE-BCAB-ADBB8B624EF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2E7A83DE-9B0C-4ACE-BCAB-ADBB8B624EF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2E7A83DE-9B0C-4ACE-BCAB-ADBB8B624EF8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9772A869-D6F0-4BE4-A42F-A64420405223}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9772A869-D6F0-4BE4-A42F-A64420405223}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9772A869-D6F0-4BE4-A42F-A64420405223}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9772A869-D6F0-4BE4-A42F-A64420405223}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/backend/justfile b/backend/justfile
new file mode 100644
index 0000000..59f4670
--- /dev/null
+++ b/backend/justfile
@@ -0,0 +1,2 @@
+dev:
+ dotnet watch --project ./Elements.Backend \ No newline at end of file