Browse Source

Added Go Pine framework (#9358)

Bryan Mwangi 9 months ago
parent
commit
f466068176

+ 11 - 0
frameworks/Go/pine/README.md

@@ -0,0 +1,11 @@
+# Pine Benchmarking Test
+
+## Test URLs
+
+### JSON
+
+http://localhost:8080/json
+
+### PLAINTEXT
+
+http://localhost:8080/plaintext

+ 26 - 0
frameworks/Go/pine/benchmark_config.json

@@ -0,0 +1,26 @@
+{
+  "framework": "pine",
+  "tests": [
+    {
+      "default": {
+        "json_url": "/json",
+        "plaintext_url": "/plaintext",
+        "port": 8080,
+        "approach": "Realistic",
+        "classification": "Micro",
+        "database": "None",
+        "framework": "Pine",
+        "language": "Go",
+        "flavor": "None",
+        "orm": "None",
+        "platform": "None",
+        "webserver": "None",
+        "os": "Linux",
+        "database_os": "Linux",
+        "display_name": "Pine",
+        "notes": "",
+        "versus": "go"
+      }
+    }
+  ]
+}

+ 10 - 0
frameworks/Go/pine/pine.dockerfile

@@ -0,0 +1,10 @@
+FROM docker.io/golang:1.23
+
+COPY ./src /pine
+WORKDIR /pine
+
+RUN go mod download
+
+EXPOSE 8080
+
+CMD go run .

+ 5 - 0
frameworks/Go/pine/src/go.mod

@@ -0,0 +1,5 @@
+module pine
+
+go 1.23.0
+
+require github.com/BryanMwangi/pine v1.0.6

+ 2 - 0
frameworks/Go/pine/src/go.sum

@@ -0,0 +1,2 @@
+github.com/BryanMwangi/pine v1.0.6 h1:35JN1FQkStoCikeVQJ2423mO5STLNEPkA/AgnjslAmg=
+github.com/BryanMwangi/pine v1.0.6/go.mod h1:j6+gT+N2HeeJHc9Z60rUOnEmNC+s/Gdmh2e9oB/eScI=

+ 28 - 0
frameworks/Go/pine/src/main.go

@@ -0,0 +1,28 @@
+package main
+
+import (
+	"log"
+
+	"github.com/BryanMwangi/pine"
+)
+
+func plaintextHandler(c *pine.Ctx) error {
+	c.Set("Server", "Pine")
+	return c.SendString("Hello, World!")
+}
+
+func jsonHandler(c *pine.Ctx) error {
+	c.Set("Server", "Pine")
+	return c.JSON(map[string]string{
+		"message": "Hello, World!",
+	})
+}
+
+func main() {
+	app := pine.New()
+	app.Get("/plaintext", plaintextHandler)
+	app.Get("/json", jsonHandler)
+
+	// Start the server on port 3000
+	log.Fatal(app.Start(":8080"))
+}