Skip to content

Commit

Permalink
start .net8 backend project
Browse files Browse the repository at this point in the history
  • Loading branch information
RayanFarhat committed Apr 2, 2024
1 parent 5a8e3c8 commit 92e7123
Show file tree
Hide file tree
Showing 28 changed files with 1,573 additions and 5 deletions.
83 changes: 83 additions & 0 deletions Backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
###################
# compiled source #
###################
*.com
*.class
*.dll
*.exe
*.pdb
*.dll.config
*.cache
*.suo
# Include dlls if they’re in the NuGet packages directory
!/packages/*/lib/*.dll
!/packages/*/lib/*/*.dll
# Include dlls if they're in the CommonReferences directory
!*CommonReferences/*.dll
####################
# VS Upgrade stuff #
####################
UpgradeLog.XML
_UpgradeReport_Files/
###############
# Directories #
###############
bin/
obj/
TestResults/
###################
# Web publish log #
###################
*.Publish.xml
#############
# Resharper #
#############
/_ReSharper.*
*.ReSharper.*
############
# Packages #
############
# it’s better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
######################
# Logs and databases #
######################
*.log
*.sqlite
# OS generated files #
######################
.DS_Store?
ehthumbs.db
Icon?
Thumbs.db
[Bb]in
[Oo]bj
[Tt]est[Rr]esults
*.suo
*.user
*.[Cc]ache
*[Rr]esharper*
packages
NuGet.exe
_[Ss]cripts
*.exe
*.dll
*.nupkg
*.ncrunchsolution

# DB #
######################
/database/postgresql/

#/sessionCache/redis_data/
.env

/certbot
Binary file added Backend/.vs/Backend/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1,021 changes: 1,021 additions & 0 deletions Backend/.vs/Backend/config/applicationhost.config

Large diffs are not rendered by default.

Binary file added Backend/.vs/Backend/v17/.futdcache.v2
Binary file not shown.
45 changes: 45 additions & 0 deletions Backend/.vs/Backend/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\ryanf\\Desktop\\StructLite\\Backend\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{55533585-641E-4F7A-B137-8287E65C04B8}|Backend.csproj|c:\\users\\ryanf\\desktop\\structlite\\backend\\.gitignore||{3B902123-F8A7-4915-9F01-361F908088D0}",
"RelativeMoniker": "D:0:0:{55533585-641E-4F7A-B137-8287E65C04B8}|Backend.csproj|solutionrelative:.gitignore||{3B902123-F8A7-4915-9F01-361F908088D0}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 2,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{3ae79031-e1bc-11d0-8f78-00a0c9110057}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{eefa5220-e298-11d0-8f78-00a0c9110057}"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": ".gitignore",
"DocumentMoniker": "C:\\Users\\ryanf\\Desktop\\StructLite\\Backend\\.gitignore",
"RelativeDocumentMoniker": ".gitignore",
"ToolTip": "C:\\Users\\ryanf\\Desktop\\StructLite\\Backend\\.gitignore",
"RelativeToolTip": ".gitignore",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAFIAAAAIAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
"WhenOpened": "2024-04-02T20:10:22.66Z",
"EditorCaption": ""
}
]
}
]
}
]
}
Binary file not shown.
Binary file not shown.
13 changes: 13 additions & 0 deletions Backend/Backend.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions Backend/Backend.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@Backend_HostAddress = http://localhost:5260

GET {{Backend_HostAddress}}/weatherforecast/
Accept: application/json

###
25 changes: 25 additions & 0 deletions Backend/Backend.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34723.18
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Backend", "Backend.csproj", "{55533585-641E-4F7A-B137-8287E65C04B8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{55533585-641E-4F7A-B137-8287E65C04B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{55533585-641E-4F7A-B137-8287E65C04B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{55533585-641E-4F7A-B137-8287E65C04B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{55533585-641E-4F7A-B137-8287E65C04B8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E0757028-4643-48EB-8B8A-71EFA74F41EB}
EndGlobalSection
EndGlobal
33 changes: 33 additions & 0 deletions Backend/Controllers/WeatherForecastController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Microsoft.AspNetCore.Mvc;

namespace 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.AddDays(index)),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}
}
25 changes: 25 additions & 0 deletions Backend/Program.cs
Original file line number Diff line number Diff line change
@@ -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();
23 changes: 23 additions & 0 deletions Backend/Properties/PublishProfiles/structlite - Zip Deploy.pubxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<WebPublishMethod>ZipDeploy</WebPublishMethod>
<IsLinux>true</IsLinux>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<ResourceId>/subscriptions/6b4aa337-333b-4db5-a4a6-e3514ce0532c/resourceGroups/structliteRes/providers/Microsoft.Web/sites/structlite</ResourceId>
<ResourceGroup>structliteRes</ResourceGroup>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<SiteUrlToLaunchAfterPublish>https://structlite.azurewebsites.net</SiteUrlToLaunchAfterPublish>
<PublishProvider>AzureWebSite</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<ProjectGuid>55533585-641e-4f7a-b137-8287e65c04b8</ProjectGuid>
<PublishUrl>https://structlite.scm.azurewebsites.net/</PublishUrl>
<UserName>$structlite</UserName>
<_SavePWD>true</_SavePWD>
</PropertyGroup>
</Project>
Loading

0 comments on commit 92e7123

Please sign in to comment.