Recreated plugin with new project template. Started implementing server system daemon
This commit is contained in:
21
MoonlightServers.Api/Http/Controllers/FormController.cs
Normal file
21
MoonlightServers.Api/Http/Controllers/FormController.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MoonlightServers.Shared.Http.Requests;
|
||||
using MoonlightServers.Shared.Http.Responses;
|
||||
|
||||
namespace MoonlightServers.Api.Http.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/form")]
|
||||
public class FormController : Controller
|
||||
{
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<FormResultDto>> PostAsync([FromBody] FormSubmitDto dto)
|
||||
{
|
||||
return new FormResultDto()
|
||||
{
|
||||
Result = dto.TextField.Replace(" ", string.Empty)
|
||||
};
|
||||
}
|
||||
}
|
||||
36
MoonlightServers.Api/MoonlightServers.Api.csproj
Normal file
36
MoonlightServers.Api/MoonlightServers.Api.csproj
Normal file
@@ -0,0 +1,36 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<SupportedPlatform Include="browser"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Moonlight.Api" Version="2.1.0">
|
||||
<ExcludeAssets>content;contentfiles</ExcludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Configuration\"/>
|
||||
<Folder Include="Database\Entities\"/>
|
||||
<Folder Include="Database\Migrations\"/>
|
||||
<Folder Include="Helpers\"/>
|
||||
<Folder Include="Implementations\"/>
|
||||
<Folder Include="Interfaces\"/>
|
||||
<Folder Include="Mappers\"/>
|
||||
<Folder Include="Models\"/>
|
||||
<Folder Include="Services\"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MoonlightServers.Shared\MoonlightServers.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
21
MoonlightServers.Api/Startup.cs
Normal file
21
MoonlightServers.Api/Startup.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Moonlight.Api;
|
||||
using SimplePlugin.Abstractions;
|
||||
using SerializationContext = MoonlightServers.Shared.SerializationContext;
|
||||
|
||||
namespace MoonlightServers.Api;
|
||||
|
||||
[PluginModule]
|
||||
public class Startup : MoonlightPlugin
|
||||
{
|
||||
public override void PreBuild(WebApplicationBuilder builder)
|
||||
{
|
||||
builder.Services.AddControllers()
|
||||
.AddApplicationPart(typeof(Startup).Assembly)
|
||||
.AddJsonOptions(options =>
|
||||
{
|
||||
options.JsonSerializerOptions.TypeInfoResolverChain.Add(SerializationContext.Default);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user