Skip to content

Commit 4a79d82

Browse files
2vgmichaelhixson
authored andcommitted
add: json tests "mofuw", and some update and edit. (#3794)
1 parent 3ef5724 commit 4a79d82

File tree

4 files changed

+36
-34
lines changed

4 files changed

+36
-34
lines changed

frameworks/Nim/mofuw/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
> mofuw is \***MO**re\* \***F**\*aster, \***U**ltra\* \***W**\*eb server.
44
55
## Includes tests
6-
- plaintext\: `"localhost:8080/plaintext"`
6+
- plaintext: `localhost:8080/plaintext`
7+
- json: `localhost:8080/json`
78

89
## Require
9-
- Nim 0.18.0 +
10+
- Nim => 0.18.0
11+
- mofuw => 1.1.8
Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
{
2-
"framework": "mofuw",
3-
"tests": [{
4-
"default": {
5-
"plaintext_url": "/plaintext",
6-
"port": 8080,
7-
"approach": "Realistic",
8-
"classification": "Micro",
9-
"database": "None",
10-
"framework": "mofuw",
11-
"language": "Nim",
12-
"orm": "Raw",
13-
"platform": "None",
14-
"webserver": "mofuw",
15-
"os": "Linux",
16-
"database_os": "Linux",
17-
"display_name": "mofuw",
18-
"notes": "",
19-
"versus": ""
20-
}
21-
}]
2+
"framework": "mofuw",
3+
"tests": [{
4+
"default": {
5+
"json_url": "/json",
6+
"plaintext_url": "/plaintext",
7+
"port": 8080,
8+
"approach": "Realistic",
9+
"classification": "Platform",
10+
"database": "MySQL",
11+
"framework": "None",
12+
"language": "Nim",
13+
"flavor": "None",
14+
"orm": "Raw",
15+
"platform": "None",
16+
"webserver": "None",
17+
"os": "Linux",
18+
"database_os": "Linux",
19+
"display_name": "mofuw",
20+
"notes": "",
21+
"versus": "Nim"
22+
}
23+
}]
2224
}
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM gcc:7
1+
FROM gcc:latest
22

33
RUN apt update -yqq && \
44
mkdir -p /nim && \
@@ -11,18 +11,13 @@ RUN apt update -yqq && \
1111
cd ../ && \
1212
bin/nim c koch && \
1313
./koch boot -d:release && \
14-
./koch nimble && \
1514
./koch tools
1615

1716
ENV PATH $PATH:/nim/nim-devel/bin:/root/.nimble/bin
1817

19-
WORKDIR /mofu_framework
20-
RUN git clone https://github.com/2vg/mofuw.git && \
21-
cd mofuw && \
22-
nimble update && \
23-
echo 'y' | nimble install
18+
RUN nimble install -y mofuw
2419

25-
WORKDIR /mofuw_app
20+
WORKDIR /mofuwApp
2621
COPY techempower.nim techempower.nim
27-
RUN nim c -d:release --threads:on techempower.nim
22+
RUN nim c -d:release --threads:on -d:bufSize:512 techempower.nim
2823
CMD ["./techempower"]
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import mofuw
1+
import mofuw, json
22

33
proc h(req: mofuwReq, res: mofuwRes) {.async.} =
4-
if getPath(req) == "/plaintext":
4+
case req.getPath
5+
of "/plaintext":
56
mofuwResp(HTTP200, "text/plain", "Hello, World!")
7+
of "/json":
8+
mofuwResp(HTTP200, "application/json", $(%{"message": %"Hello, World!"}))
69
else:
710
mofuwResp(HTTP404, "text/plain", "NOT FOUND")
811

9-
h.mofuwRun(port = 8080, bufSize = 1024)
12+
h.mofuwRun(port = 8080)

0 commit comments

Comments
 (0)