File tree Expand file tree Collapse file tree 3 files changed +68
-0
lines changed
csharp/effinitive-framework Expand file tree Collapse file tree 3 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 1+ using EffinitiveFramework . Core ;
2+
3+ var app = EffinitiveApp
4+ . Create ( )
5+ . UsePort ( 3000 )
6+ . MapEndpoints ( )
7+ . Build ( ) ;
8+
9+ await app . RunAsync ( ) ;
10+
11+ public class RootEndpoint : AsyncEndpointBase < EmptyRequest , EmptyResponse >
12+ {
13+ protected override string Method => "GET" ;
14+ protected override string Route => "/" ;
15+
16+ public override Task < EmptyResponse > HandleAsync (
17+ EmptyRequest request ,
18+ CancellationToken cancellationToken = default )
19+ {
20+ return Task . FromResult ( new EmptyResponse ( ) ) ;
21+ }
22+ }
23+
24+ public class GetUserEndpoint : AsyncEndpointBase < UserIdRequest , string >
25+ {
26+ protected override string Method => "GET" ;
27+ protected override string Route => "/user/{id}" ;
28+
29+ public override Task < string > HandleAsync (
30+ UserIdRequest request ,
31+ CancellationToken cancellationToken = default )
32+ {
33+ return Task . FromResult ( request . Id ) ;
34+ }
35+ }
36+
37+ public class CreateUserEndpoint : AsyncEndpointBase < EmptyRequest , EmptyResponse >
38+ {
39+ protected override string Method => "POST" ;
40+ protected override string Route => "/user" ;
41+
42+ public override Task < EmptyResponse > HandleAsync (
43+ EmptyRequest request ,
44+ CancellationToken cancellationToken = default )
45+ {
46+ return Task . FromResult ( new EmptyResponse ( ) ) ;
47+ }
48+ }
49+
50+ public class EmptyRequest { }
51+ public class EmptyResponse { }
52+ public class UserIdRequest
53+ {
54+ public string Id { get ; set ; } = string . Empty ;
55+ }
Original file line number Diff line number Diff line change 1+ framework :
2+ github : HBartosch/Effinitive
3+ version : 1.0
Original file line number Diff line number Diff line change 1+ <Project Sdk =" Microsoft.NET.Sdk.Web" >
2+ <PropertyGroup >
3+ <TargetFramework >net10.0</TargetFramework >
4+ <ImplicitUsings >enable</ImplicitUsings >
5+ </PropertyGroup >
6+
7+ <ItemGroup >
8+ <PackageReference Include =" EffinitiveFramework.Core" Version =" 1.0.*" />
9+ </ItemGroup >
10+ </Project >
You can’t perform that action at this time.
0 commit comments