File tree 1 file changed +61
-0
lines changed
1 file changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ # omikuji-server
2
+
3
+ omikuji-server is a JSON API server that randomly returns fortune.
4
+
5
+ ## How to try
6
+
7
+ The server side starts as follows.
8
+
9
+ ``` shell
10
+ $ make build
11
+ $ ./omikuji-server
12
+ ```
13
+
14
+ The client side sends a request as follows.
15
+
16
+ ``` shell
17
+ $ curl -s localhost:8080 | jq .
18
+ {
19
+ " name" : " Gopher" ,
20
+ " fortune" : " 吉"
21
+ }
22
+ ```
23
+
24
+ You can change the name returned from the default "Gopher" by specifying the name parameter.
25
+
26
+ ``` shell
27
+ $ curl -s ' localhost:8080/?name=hioki-daichi' | jq .
28
+ {
29
+ " name" : " hioki-daichi" ,
30
+ " fortune" : " 大凶"
31
+ }
32
+ ```
33
+
34
+ The name can be up to 32 characters.
35
+
36
+ ``` shell
37
+ $ curl -s ' localhost:8080/?name=A%20name%20longer%20than%20thirty%20two%20characters' | jq .
38
+ {
39
+ " errors" : [
40
+ " Name is too long (maximum is 32 characters)"
41
+ ]
42
+ }
43
+ ```
44
+
45
+ ## How to run the test
46
+
47
+ ``` shell
48
+ $ make test
49
+ ```
50
+
51
+ ## How to read GoDoc
52
+
53
+ ``` shell
54
+ $ make doc
55
+ ```
56
+
57
+ ## How to see code coverage
58
+
59
+ ``` shell
60
+ $ make cov
61
+ ```
You can’t perform that action at this time.
0 commit comments