Skip to content

Commit 902d4e0

Browse files
Merge pull request #9558 from CypherPotato/master
update sisk version
2 parents 4cc3ed6 + f715357 commit 902d4e0

File tree

7 files changed

+140
-41
lines changed

7 files changed

+140
-41
lines changed
Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,41 @@
11
{
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+
}

frameworks/CSharp/sisk/config.toml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,24 @@ name = "sisk"
55
urls.plaintext = "/plaintext"
66
urls.json = "/json"
77
approach = "Realistic"
8-
classification = "Fullstack"
8+
classification = "Micro"
99
database = "None"
1010
database_os = "Linux"
1111
os = "Linux"
1212
orm = "Raw"
1313
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"
1528
versus = "None"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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>
Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
1-
using Sisk.Core.Http;
1+
using System.Net.Http.Json;
2+
using Sisk.Core.Http;
23
using Sisk.Core.Routing;
3-
using System.Net.Http.Json;
44

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 ();
98

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 );
1211

13-
app.Start();
12+
app.Start ();
1413

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!" );
1816
}
1917

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 {
2420
message = "Hello, world!"
25-
}));
21+
} ) );
2622
}

frameworks/CSharp/sisk/sisk/sisk.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Sisk.HttpServer" Version="0.16.2" />
12+
<PackageReference Include="Sisk.HttpServer" Version="1.4.0-beta3" />
1313
</ItemGroup>
1414

1515
</Project>

0 commit comments

Comments
 (0)