Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PackageVersion Include="Grpc.Core" Version="2.46.6" />
<PackageVersion Include="Grpc.Tools" Version="2.72.0" />
<PackageVersion Include="HtmlTags" Version="9.0.0" />
<PackageVersion Include="JasperFx" Version="1.21.3" />
<PackageVersion Include="JasperFx" Version="1.22.0" />
<PackageVersion Include="JasperFx.Events" Version="1.24.1" />
<PackageVersion Include="JasperFx.RuntimeCompiler" Version="4.4.0" />
<PackageVersion Include="Lamar.Microsoft.DependencyInjection" Version="15.0.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// <auto-generated/>
#pragma warning disable
using Microsoft.AspNetCore.Routing;
using System;
using System.Linq;
using Wolverine.Http;

namespace Internal.Generated.WolverineHandlers
{
// START: GET_api_test
[global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
public sealed class GET_api_test : Wolverine.Http.HttpHandler
{
private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions;

public GET_api_test(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions)
{
_wolverineHttpOptions = wolverineHttpOptions;
}



public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext)
{

// The actual HTTP request handler execution
var result_of_Get = StartupStyleTarget.TestEndpoint.Get();

await WriteString(httpContext, result_of_Get);
}

}

// END: GET_api_test


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// <auto-generated/>
#pragma warning disable
using Microsoft.AspNetCore.Routing;
using System;
using System.Linq;
using Wolverine.Http;

namespace Internal.Generated.WolverineHandlers
{
// START: POST_api_items
[global::System.CodeDom.Compiler.GeneratedCode("JasperFx", "1.0.0")]
public sealed class POST_api_items : Wolverine.Http.HttpHandler
{
private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions;

public POST_api_items(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions)
{
_wolverineHttpOptions = wolverineHttpOptions;
}



public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext)
{
// Reading the request body via JSON deserialization
var (request, jsonContinue) = await ReadJsonAsync<StartupStyleTarget.CreateItemRequest>(httpContext);
if (jsonContinue == Wolverine.HandlerContinuation.Stop) return;

// The actual HTTP request handler execution
var result_of_Post = StartupStyleTarget.TestEndpoint.Post(request);

await WriteString(httpContext, result_of_Post);
}

}

// END: POST_api_items


}

18 changes: 18 additions & 0 deletions src/Http/StartupStyleTarget/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using JasperFx;
using Wolverine;

namespace StartupStyleTarget;

public class Program
{
public static Task<int> Main(string[] args)
{
return Host.CreateDefaultBuilder(args)
.UseWolverine()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.RunJasperFxCommands(args);
}
}
22 changes: 22 additions & 0 deletions src/Http/StartupStyleTarget/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Wolverine;
using Wolverine.Http;

namespace StartupStyleTarget;

public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddWolverineHttp();
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();

app.UseEndpoints(endpoints =>
{
endpoints.MapWolverineEndpoints();
});
}
}
13 changes: 13 additions & 0 deletions src/Http/StartupStyleTarget/StartupStyleTarget.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

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

<ItemGroup>
<ProjectReference Include="..\Wolverine.Http\Wolverine.Http.csproj" />
</ItemGroup>

</Project>
20 changes: 20 additions & 0 deletions src/Http/StartupStyleTarget/TestEndpoint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Wolverine.Http;

namespace StartupStyleTarget;

public static class TestEndpoint
{
[WolverineGet("/api/test")]
public static string Get()
{
return "tested";
}

[WolverinePost("/api/items")]
public static string Post(CreateItemRequest request)
{
return $"Created: {request.Name}";
}
}

public record CreateItemRequest(string Name);
Loading