v0.0.0 Refactor backend code base structure

This commit is contained in:
Murtadha 2024-07-20 16:05:49 -04:00
parent b9f3fba383
commit 6d6cfc2c68
11 changed files with 102 additions and 30 deletions

51
README.md Normal file
View file

@ -0,0 +1,51 @@
# Portfolio Backend
This is the backend for the portfolio project, built with .NET 8.0.
## Project Structure
```
backend/
├── src/
│ └── PortfolioBackend/
│ ├── Controllers/
│ ├── Models/
│ ├── Repositories/
│ ├── Services/
│ ├── Migrations/
│ ├── Program.cs
│ ├── appsettings.json
│ ├── appsettings.Development.json
│ └── PortfolioBackend.csproj
├── tests/
│ └── PortfolioBackend.Tests/
│ ├── Controllers/
│ ├── Models/
│ ├── Repositories/
│ ├── Services/
│ └── PortfolioBackend.Tests.csproj
├── docker/
│ ├── Dockerfile
│ └── docker-compose.yml
├── .gitignore
└── README.md
```
## Setup
1. Ensure you have .NET 8.0 SDK installed.
2. Clone this repository.
3. Navigate to the `src/PortfolioBackend` directory.
4. Run `dotnet restore` to restore the NuGet packages.
5. Run `dotnet run` to start the application.
## Running with Docker
1. Ensure you have Docker and Docker Compose installed.
2. Navigate to the `docker` directory.
3. Run `docker-compose up --build` to build and start the containers.
## Running Tests
1. Navigate to the `tests/PortfolioBackend.Tests` directory.
2. Run `dotnet test` to run the unit tests.

View file

@ -1,20 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
</Project>

View file

@ -1,6 +0,0 @@
@backend_HostAddress = http://localhost:5001
GET {{backend_HostAddress}}/weatherforecast/
Accept: application/json
###

0
docker/Dockerfile Normal file
View file

View file

View file

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,6 @@
@PortfolioBackend_HostAddress = http://localhost:5231
GET {{PortfolioBackend_HostAddress}}/weatherforecast/
Accept: application/json
###

View file

@ -4,8 +4,8 @@
"windowsAuthentication": false, "windowsAuthentication": false,
"anonymousAuthentication": true, "anonymousAuthentication": true,
"iisExpress": { "iisExpress": {
"applicationUrl": "http://localhost:65439", "applicationUrl": "http://localhost:39132",
"sslPort": 44367 "sslPort": 44397
} }
}, },
"profiles": { "profiles": {
@ -14,7 +14,7 @@
"dotnetRunMessages": true, "dotnetRunMessages": true,
"launchBrowser": true, "launchBrowser": true,
"launchUrl": "swagger", "launchUrl": "swagger",
"applicationUrl": "http://localhost:5001", "applicationUrl": "http://localhost:5231",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
@ -24,7 +24,7 @@
"dotnetRunMessages": true, "dotnetRunMessages": true,
"launchBrowser": true, "launchBrowser": true,
"launchUrl": "swagger", "launchUrl": "swagger",
"applicationUrl": "https://localhost:7195;http://localhost:5001", "applicationUrl": "https://localhost:7162;http://localhost:5231",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }

View file

@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>
<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\PortfolioBackend\PortfolioBackend.csproj" />
</ItemGroup>
</Project>