Browse Source

Added Tetsu.Web framework (#4887)

* Added Tetsu.Web framework

* Update framework

* Fix typo in csproj

* Listen on 0.0.0.0

* Updated framework version
Gokberk Yaltirakli 6 years ago
parent
commit
38644344b5

+ 37 - 0
frameworks/CSharp/tetsuweb/.gitignore

@@ -0,0 +1,37 @@
+[Oo]bj/
+[Bb]in/
+TestResults/
+.nuget/
+*.sln.ide/
+_ReSharper.*/
+.idea/
+packages/
+artifacts/
+PublishProfiles/
+.vs/
+*.user
+*.suo
+*.cache
+*.docstates
+_ReSharper.*
+nuget.exe
+*net45.csproj
+*net451.csproj
+*k10.csproj
+*.psess
+*.vsp
+*.pidb
+*.userprefs
+*DS_Store
+*.ncrunchsolution
+*.*sdf
+*.ipch
+*.swp
+*~
+.build/
+.testPublish/
+launchSettings.json
+BenchmarkDotNet.Artifacts/
+BDN.Generated/
+binaries/
+global.json

+ 13 - 0
frameworks/CSharp/tetsuweb/Benchmark/Benchmark.csproj

@@ -0,0 +1,13 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>netcoreapp2.2</TargetFramework>
+  </PropertyGroup>
+
+  <ItemGroup>
+      <PackageReference Include="Tetsu.Web" Version="0.1.3" />
+      <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
+  </ItemGroup>
+
+</Project>

+ 26 - 0
frameworks/CSharp/tetsuweb/Benchmark/Program.cs

@@ -0,0 +1,26 @@
+using System;
+using Newtonsoft.Json;
+using Tetsu.Web;
+
+namespace Benchmark {
+    public class Program {
+        public static void Main() {
+            var server = new Server();
+
+            server.Handle("/plaintext", ctx =>
+                ctx.Response.TextContent = "Hello, World!");
+
+            server.Handle("/json", ctx => {
+                ctx.Response.SetHeader("Content-Type", "application/json");
+                ctx.Response.TextContent = JsonConvert.SerializeObject(new {
+                    message = "Hello, World!"
+                });
+            });
+
+            server.AddMiddleware(ctx =>
+                ctx.Response.SetHeader("Date", DateTime.UtcNow.ToString("r")));
+
+            server.Listen("0.0.0.0", 1234).Wait();
+        }
+    }
+}

+ 15 - 0
frameworks/CSharp/tetsuweb/README.md

@@ -0,0 +1,15 @@
+# Tetsu.Web Benchmark
+
+## Infrastructure Software Versions
+
+**Language**
+
+* C#
+
+**Platforms**
+
+* .NET Core (Windows and Linux)
+
+**Web Stack**
+
+* [Tetsu.Web](https://github.com/gkbrk/TetsuWeb)

+ 24 - 0
frameworks/CSharp/tetsuweb/benchmark_config.json

@@ -0,0 +1,24 @@
+{
+  "framework": "tetsuweb",
+  "tests": [{
+    "default": {
+      "plaintext_url": "/plaintext",
+      "json_url": "/json",
+      "port": 1234,
+      "approach": "Realistic",
+      "classification": "Micro",
+      "database": "None",
+      "framework": "Tetsu",
+      "language": "C#",
+      "orm": "Raw",
+      "platform": ".NET",
+      "flavor": "CoreCLR",
+      "webserver": "Tetsu",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "Tetsu.Web",
+      "notes": "",
+      "versus": "aspcore"
+    }
+  }]
+}

+ 10 - 0
frameworks/CSharp/tetsuweb/tetsuweb.dockerfile

@@ -0,0 +1,10 @@
+FROM microsoft/dotnet:2.2-sdk AS build
+WORKDIR /app
+COPY Benchmark .
+RUN dotnet publish -c Release -o out
+
+FROM mcr.microsoft.com/dotnet/core/runtime:2.2
+WORKDIR /app
+COPY --from=build /app/out ./
+
+ENTRYPOINT ["dotnet", "Benchmark.dll"]