diff --git a/README.md b/README.md index c145588..f75a82c 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ # react-dotnet +https://github.com/sethbr11/react-dotnet diff --git a/backend/.gitignore b/backend/.gitignore new file mode 100644 index 0000000..fba4707 --- /dev/null +++ b/backend/.gitignore @@ -0,0 +1,210 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# Build results +[Bb]in/ +[Oo]bj/ +[Ee]xt/ +[Ll]og/ +[Ll]ogs/ + +# MSBuild Binary and Structured Log +*.binlog + +# MSBuild response files +!MSBuild.rsp +!Directory.Build.rsp + +# Visual Studio 14+ cache/options directory +.vs/ + +# Visual Studio 15+ auto generated files +Generated\ Files/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*~.* +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# Microsoft Fakes +FakesAssemblies/ + +# CodeRush personal settings +.cr/personal + +# JetBrains Rider +*.sln.iml \ No newline at end of file diff --git a/backend/Controllers/UserController.cs b/backend/Controllers/UserController.cs new file mode 100644 index 0000000..2f53567 --- /dev/null +++ b/backend/Controllers/UserController.cs @@ -0,0 +1,17 @@ +using Microsoft.AspNetCore.Mvc; +using Backend.Data; + +namespace Backend.Controllers +{ + [Route("v1/[controller]")] + [ApiController] + public class UserController : ControllerBase + { + private readonly IUserRepository _userRepository; + + public UserController(IUserRepository userRepository) + { + _userRepository = userRepository; + } + } +} diff --git a/backend/Data/IUserRepository.cs b/backend/Data/IUserRepository.cs new file mode 100644 index 0000000..001e567 --- /dev/null +++ b/backend/Data/IUserRepository.cs @@ -0,0 +1,5 @@ +namespace Backend.Data; + +public interface IUserRepository +{ +} diff --git a/backend/Program.cs b/backend/Program.cs new file mode 100644 index 0000000..acbf762 --- /dev/null +++ b/backend/Program.cs @@ -0,0 +1,37 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +// using Backend.Data +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddControllers(); +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +builder.Services.AddCors(); + +//builder.Services.AddDbContext(options => +// options.UseSqlite(builder.Configuration["ConnectionStrings:UserConnection"]) +//); + +//builder.Services.AddScoped(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseCors(p => p.WithOrigins("http://localhost:3000")); + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); \ No newline at end of file diff --git a/backend/Properties/launchSettings.json b/backend/Properties/launchSettings.json new file mode 100644 index 0000000..d4b76f7 --- /dev/null +++ b/backend/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:36350", + "sslPort": 44332 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5231", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7035;http://localhost:5231", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/backend/appsettings.json b/backend/appsettings.json new file mode 100644 index 0000000..7380ed6 --- /dev/null +++ b/backend/appsettings.json @@ -0,0 +1,12 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "ConnectionStrings": { + "BowlingLeagueConnection": "Data Source=BowlingLeague.sqlite" + } +} \ No newline at end of file diff --git a/backend/backend.csproj b/backend/backend.csproj new file mode 100644 index 0000000..41b8026 --- /dev/null +++ b/backend/backend.csproj @@ -0,0 +1,23 @@ + + + + net10.0 + enable + enable + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/backend/backend.http b/backend/backend.http new file mode 100644 index 0000000..4ad8c81 --- /dev/null +++ b/backend/backend.http @@ -0,0 +1,6 @@ +@Backend_HostAddress = http://localhost:3000 + +GET {{Backend_HostAddress}}/weatherforecast/ +Accept: application/json + +### \ No newline at end of file