Rename old C# backend folder
This commit is contained in:
parent
f3eb84d812
commit
dc685661a7
16 changed files with 0 additions and 0 deletions
25
backend-C#/LeakyShipsAPI/.dockerignore
Normal file
25
backend-C#/LeakyShipsAPI/.dockerignore
Normal file
|
@ -0,0 +1,25 @@
|
|||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/.idea
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
20
backend-C#/LeakyShipsAPI/Dockerfile
Normal file
20
backend-C#/LeakyShipsAPI/Dockerfile
Normal file
|
@ -0,0 +1,20 @@
|
|||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["LeakyShipsAPI/LeakyShipsAPI.csproj", "LeakyShipsAPI/"]
|
||||
RUN dotnet restore "LeakyShipsAPI/LeakyShipsAPI.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/LeakyShipsAPI"
|
||||
RUN dotnet build "LeakyShipsAPI.csproj" -c Release -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "LeakyShipsAPI.csproj" -c Release -o /app/publish
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "LeakyShipsAPI.dll"]
|
8
backend-C#/LeakyShipsAPI/Hubs/GameHub.cs
Normal file
8
backend-C#/LeakyShipsAPI/Hubs/GameHub.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace LeakyShipsAPI.Hubs;
|
||||
|
||||
public class GameHub : Hub
|
||||
{
|
||||
|
||||
}
|
15
backend-C#/LeakyShipsAPI/LeakyShipsAPI.csproj
Normal file
15
backend-C#/LeakyShipsAPI/LeakyShipsAPI.csproj
Normal file
|
@ -0,0 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.4.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
3
backend-C#/LeakyShipsAPI/Model/Board.cs
Normal file
3
backend-C#/LeakyShipsAPI/Model/Board.cs
Normal file
|
@ -0,0 +1,3 @@
|
|||
namespace LeakyShipsAPI.Model;
|
||||
|
||||
public record Board(Guid Id);
|
3
backend-C#/LeakyShipsAPI/Model/Player.cs
Normal file
3
backend-C#/LeakyShipsAPI/Model/Player.cs
Normal file
|
@ -0,0 +1,3 @@
|
|||
namespace LeakyShipsAPI.Model;
|
||||
|
||||
public record Player(Guid Id, string Name);
|
3
backend-C#/LeakyShipsAPI/Model/Session.cs
Normal file
3
backend-C#/LeakyShipsAPI/Model/Session.cs
Normal file
|
@ -0,0 +1,3 @@
|
|||
namespace LeakyShipsAPI.Model;
|
||||
|
||||
public record Session(Guid Id, Player PlayerOne, Player PlayerTwo);
|
41
backend-C#/LeakyShipsAPI/Program.cs
Normal file
41
backend-C#/LeakyShipsAPI/Program.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using LeakyShipsAPI.Hubs;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSignalR();
|
||||
builder.Services.AddSwaggerGen();
|
||||
builder.Services.AddCors();
|
||||
|
||||
var app = builder.Build();
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
app.UseCors(policyBuilder => policyBuilder
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyOrigin()
|
||||
.AllowCredentials()
|
||||
);
|
||||
}
|
||||
app.UseHttpsRedirection();
|
||||
app.UseRouting();
|
||||
app.UseAuthorization();
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapHub<GameHub>("/hub");
|
||||
});
|
||||
|
||||
app.MapGet("/", () => "Hello World!");
|
||||
|
||||
//Websocket functions
|
||||
|
||||
//SessionStart name -> sessionId
|
||||
//SessionJoin sessionCode, name -> sessionId
|
||||
//StartGame sessionId, settings
|
||||
//SubmitBoard shipPositions[] ->
|
||||
//
|
||||
|
||||
app.Run();
|
28
backend-C#/LeakyShipsAPI/Properties/launchSettings.json
Normal file
28
backend-C#/LeakyShipsAPI/Properties/launchSettings.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:9968",
|
||||
"sslPort": 44374
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"LeakyShipsAPI": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7036;http://localhost:5045",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
14
backend-C#/LeakyShipsAPI/Repositories/IRepository.cs
Normal file
14
backend-C#/LeakyShipsAPI/Repositories/IRepository.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System.Dynamic;
|
||||
|
||||
namespace LeakyShipsAPI.Repositories;
|
||||
|
||||
public interface IRepository<T>
|
||||
{
|
||||
ValueTask<T> GetById(Guid id);
|
||||
|
||||
bool Create(T entity);
|
||||
|
||||
bool Update(T entity);
|
||||
|
||||
bool Delete(T entity);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
namespace LeakyShipsAPI.Repositories;
|
||||
|
||||
public class PlayerRepository
|
||||
{
|
||||
|
||||
}
|
26
backend-C#/LeakyShipsAPI/Repositories/SessionRepository.cs
Normal file
26
backend-C#/LeakyShipsAPI/Repositories/SessionRepository.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using LeakyShipsAPI.Model;
|
||||
|
||||
namespace LeakyShipsAPI.Repositories;
|
||||
|
||||
public class SessionRepository : IRepository<Session>
|
||||
{
|
||||
public ValueTask<Session> GetById(Guid id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Create(Session entity)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Update(Session entity)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Delete(Session entity)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
8
backend-C#/LeakyShipsAPI/appsettings.Development.json
Normal file
8
backend-C#/LeakyShipsAPI/appsettings.Development.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
9
backend-C#/LeakyShipsAPI/appsettings.json
Normal file
9
backend-C#/LeakyShipsAPI/appsettings.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue