Browse Source

add: Nim's web framework "mofuw" (#3515)

* add: Nim's web framework "mofuw"

* fix: fix framework name

* edit: change compile mode "debug mode"

* fix: fix server error
momf 7 years ago
parent
commit
0701cfc999

+ 1 - 0
.travis.yml

@@ -114,6 +114,7 @@ env:
      - "TESTDIR=Lua/octopus"
      - "TESTDIR=Lua/openresty"
      - "TESTDIR=Nim/jester"
+     - "TESTDIR=Nim/mofuw"
      - "TESTDIR=Perl/dancer"
      - "TESTDIR=Perl/kelp"
      - "TESTDIR=Perl/mojolicious"

+ 9 - 0
frameworks/Nim/mofuw/README.md

@@ -0,0 +1,9 @@
+# Nim's Web Framework \"mofuw\"
+
+> mofuw is \***MO**re\* \***F**\*aster, \***U**ltra\* \***W**\*eb server.
+
+## Includes tests
+- plaintext\: `"localhost:8080/plaintext"`
+
+## Require
+- Nim 0.18.0 +

+ 22 - 0
frameworks/Nim/mofuw/benchmark_config.json

@@ -0,0 +1,22 @@
+{
+    "framework": "mofuw",
+    "tests": [{
+        "default": {
+            "plaintext_url": "/plaintext",
+            "port": 8080,
+            "approach": "Realistic",
+            "classification": "Micro",
+            "database": "None",
+            "framework": "mofuw",
+            "language": "Nim",
+            "orm": "Raw",
+            "platform": "None",
+            "webserver": "mofuw",
+            "os": "Linux",
+            "database_os": "Linux",
+            "display_name": "mofuw",
+            "notes": "",
+            "versus": ""
+        }
+    }]
+}

+ 14 - 0
frameworks/Nim/mofuw/mofuw.dockerfile

@@ -0,0 +1,14 @@
+FROM nimlang/nim:0.18.0
+
+RUN apt update -yqq
+
+RUN git clone https://github.com/2vg/mofuw.git && \
+    cd mofuw && \
+    nimble update && \
+    echo 'y' | nimble install
+
+COPY ./ ./
+
+RUN chmod a+wrx start-servers.sh
+
+CMD ./start-servers.sh

+ 7 - 0
frameworks/Nim/mofuw/start-servers.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+nim c -d:release --threads:on techempower.nim
+
+./techempower
+
+wait

+ 9 - 0
frameworks/Nim/mofuw/techempower.nim

@@ -0,0 +1,9 @@
+import mofuw
+
+proc h(req: mofuwReq, res: mofuwRes) {.async.} =
+  if getPath(req) == "/plaintext":
+    mofuwResp(HTTP200, "text/plain", "Hello, World!")
+  else:
+    mofuwResp(HTTP404, "text/plain", "NOT FOUND")
+
+h.mofuwRun(port = 8080, bufSize = 512)