File tree Expand file tree Collapse file tree 7 files changed +140
-41
lines changed Expand file tree Collapse file tree 7 files changed +140
-41
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "framework" : " sisk" ,
3
- "tests" : [{
4
- "default" : {
5
- "plaintext_url" : " /plaintext" ,
6
- "json_url" : " /json" ,
7
- "port" : 8080 ,
8
- "approach" : " Realistic" ,
9
- "classification" : " Fullstack" ,
10
- "database" : " None" ,
11
- "framework" : " Sisk" ,
12
- "language" : " C#" ,
13
- "orm" : " Raw" ,
14
- "platform" : " .NET" ,
15
- "webserver" : " Sisk" ,
16
- "os" : " Linux" ,
17
- "database_os" : " Linux" ,
18
- "display_name" : " Sisk Framework"
19
- }
20
- }]
21
- }
2
+ "framework" : " sisk" ,
3
+ "tests" : [
4
+ {
5
+ "default" : {
6
+ "plaintext_url" : " /plaintext" ,
7
+ "json_url" : " /json" ,
8
+ "port" : 8080 ,
9
+ "approach" : " Realistic" ,
10
+ "classification" : " Micro" ,
11
+ "database" : " None" ,
12
+ "framework" : " Sisk" ,
13
+ "language" : " C#" ,
14
+ "orm" : " Raw" ,
15
+ "platform" : " .NET" ,
16
+ "webserver" : " HttpListener" ,
17
+ "os" : " Linux" ,
18
+ "database_os" : " Linux" ,
19
+ "display_name" : " Sisk Framework"
20
+ }
21
+ },
22
+ {
23
+ "cadente" : {
24
+ "plaintext_url" : " /plaintext" ,
25
+ "json_url" : " /json" ,
26
+ "port" : 8080 ,
27
+ "approach" : " Realistic" ,
28
+ "classification" : " Platform" ,
29
+ "database" : " None" ,
30
+ "framework" : " Sisk" ,
31
+ "language" : " C#" ,
32
+ "orm" : " Raw" ,
33
+ "platform" : " .NET" ,
34
+ "webserver" : " Cadente" ,
35
+ "os" : " Linux" ,
36
+ "database_os" : " Linux" ,
37
+ "display_name" : " Sisk Framework (Cadente)"
38
+ }
39
+ }
40
+ ]
41
+ }
Original file line number Diff line number Diff line change @@ -5,11 +5,24 @@ name = "sisk"
5
5
urls.plaintext = " /plaintext"
6
6
urls.json = " /json"
7
7
approach = " Realistic"
8
- classification = " Fullstack "
8
+ classification = " Micro "
9
9
database = " None"
10
10
database_os = " Linux"
11
11
os = " Linux"
12
12
orm = " Raw"
13
13
platform = " .NET"
14
- webserver = " Sisk"
14
+ webserver = " HttpListener"
15
+ versus = " None"
16
+
17
+ [cadente ]
18
+ urls.plaintext = " /plaintext"
19
+ urls.json = " /json"
20
+ approach = " Realistic"
21
+ classification = " Platform"
22
+ database = " None"
23
+ database_os = " Linux"
24
+ os = " Linux"
25
+ orm = " Raw"
26
+ platform = " .NET"
27
+ webserver = " Cadente"
15
28
versus = " None"
Original file line number Diff line number Diff line change
1
+ FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
2
+ WORKDIR /source
3
+
4
+ # copy csproj and restore as distinct layers
5
+ COPY sisk-cadente/*.csproj .
6
+ RUN dotnet restore -r linux-musl-x64
7
+
8
+ # copy and publish app and libraries
9
+ COPY sisk-cadente/ .
10
+ RUN dotnet publish -c release -o /app -r linux-musl-x64
11
+
12
+ # final stage/image
13
+ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
14
+ WORKDIR /app
15
+ COPY --from=build /app .
16
+
17
+ ENTRYPOINT ["dotnet" , "./sisk.dll" ]
18
+
19
+ EXPOSE 8080
Original file line number Diff line number Diff line change
1
+ using System . Text ;
2
+ using System . Text . Json ;
3
+ using Sisk . Cadente ;
4
+
5
+ var host = new HttpHost ( 8080 , session => {
6
+ var request = session . Request ;
7
+
8
+ if ( request . Path == "/plaintext" ) {
9
+ SerializePlainTextResponse ( session . Response ) ;
10
+ }
11
+ else if ( request . Path == "/json" ) {
12
+ SerializeJsonResponse ( session . Response ) ;
13
+ }
14
+ else {
15
+ session . Response . StatusCode = 404 ;
16
+ }
17
+ } ) ;
18
+
19
+ host . Start ( ) ;
20
+ Thread . Sleep ( Timeout . Infinite ) ;
21
+
22
+ static void SerializePlainTextResponse ( HttpResponse response ) {
23
+ var contentBytes = Encoding . UTF8 . GetBytes ( "Hello, world!" ) ;
24
+
25
+ response . Headers . Add ( new HttpHeader ( "Content-Type" , "text/plain" ) ) ;
26
+ response . ResponseStream = new MemoryStream ( contentBytes ) ;
27
+ }
28
+
29
+ static void SerializeJsonResponse ( HttpResponse response ) {
30
+ var contentBytes = JsonSerializer . SerializeToUtf8Bytes ( new {
31
+ message = "Hello, world!"
32
+ } ) ;
33
+
34
+ response . Headers . Add ( new HttpHeader ( "Content-Type" , "application/json; charset=utf-8" ) ) ;
35
+ response . ResponseStream = new MemoryStream ( contentBytes ) ;
36
+ }
Original file line number Diff line number Diff line change
1
+ <Project Sdk =" Microsoft.NET.Sdk" >
2
+
3
+ <PropertyGroup >
4
+ <OutputType >Exe</OutputType >
5
+ <TargetFramework >net8.0</TargetFramework >
6
+ <ImplicitUsings >enable</ImplicitUsings >
7
+ <Nullable >enable</Nullable >
8
+ <ServerGarbageCollection >true</ServerGarbageCollection >
9
+ </PropertyGroup >
10
+
11
+ <ItemGroup >
12
+ <PackageReference Include =" Sisk.Cadente" Version =" 0.1.42-alpha1" />
13
+ </ItemGroup >
14
+
15
+ </Project >
Original file line number Diff line number Diff line change 1
- using Sisk . Core . Http ;
1
+ using System . Net . Http . Json ;
2
+ using Sisk . Core . Http ;
2
3
using Sisk . Core . Routing ;
3
- using System . Net . Http . Json ;
4
4
5
- var app = HttpServer . CreateBuilder ( host =>
6
- {
7
- host . UseListeningPort ( "http://+:8080/" ) ;
8
- } ) ;
5
+ var app = HttpServer . CreateBuilder ( host => {
6
+ host . UseListeningPort ( "http://+:8080/" ) ;
7
+ } ) . Build ( ) ;
9
8
10
- app . Router . SetRoute ( RouteMethod . Get , "/plaintext" , PlainText ) ;
11
- app . Router . SetRoute ( RouteMethod . Get , "/json" , Json ) ;
9
+ app . Router . SetRoute ( RouteMethod . Get , "/plaintext" , PlainText ) ;
10
+ app . Router . SetRoute ( RouteMethod . Get , "/json" , Json ) ;
12
11
13
- app . Start ( ) ;
12
+ app . Start ( ) ;
14
13
15
- static HttpResponse PlainText ( HttpRequest request )
16
- {
17
- return new HttpResponse ( ) . WithContent ( "Hello, world!" ) ;
14
+ static HttpResponse PlainText ( HttpRequest request ) {
15
+ return new HttpResponse ( "Hello, world!" ) ;
18
16
}
19
17
20
- static HttpResponse Json ( HttpRequest request )
21
- {
22
- return new HttpResponse ( ) . WithContent ( JsonContent . Create ( new
23
- {
18
+ static HttpResponse Json ( HttpRequest request ) {
19
+ return new HttpResponse ( JsonContent . Create ( new {
24
20
message = "Hello, world!"
25
- } ) ) ;
21
+ } ) ) ;
26
22
}
Original file line number Diff line number Diff line change 1
- <Project Sdk =" Microsoft.NET.Sdk" >
1
+ <Project Sdk =" Microsoft.NET.Sdk" >
2
2
3
3
<PropertyGroup >
4
4
<OutputType >Exe</OutputType >
9
9
</PropertyGroup >
10
10
11
11
<ItemGroup >
12
- <PackageReference Include =" Sisk.HttpServer" Version =" 0.16.2 " />
12
+ <PackageReference Include =" Sisk.HttpServer" Version =" 1.4.0-beta3 " />
13
13
</ItemGroup >
14
14
15
15
</Project >
You can’t perform that action at this time.
0 commit comments