File tree Expand file tree Collapse file tree 5 files changed +59
-6
lines changed Expand file tree Collapse file tree 5 files changed +59
-6
lines changed Original file line number Diff line number Diff line change 1+ name : Go
2+ on : [push]
3+ jobs :
4+
5+ build :
6+ name : Build
7+ runs-on : ubuntu-latest
8+ steps :
9+
10+ - name : Set up Go 1.13
11+ uses : actions/setup-go@v1
12+ with :
13+ go-version : 1.13
14+ id : go
15+
16+ - name : Check out code into the Go module directory
17+ uses : actions/checkout@v2
18+
19+ - name : Get dependencies
20+ run : |
21+ go get -v -t -d ./...
22+ if [ -f Gopkg.toml ]; then
23+ curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
24+ dep ensure
25+ fi
26+ - name : Build
27+ run : go build -v .
Original file line number Diff line number Diff line change 1- # go-json-server
1+
2+ ![ Go] ( https://github.com/tkc/go-json-server/workflows/Go/badge.svg?branch=master )
3+
4+ ```
5+ ___ _ ___
6+ / __|___ _ | |__ _ ___ _ _ / __| ___ _ ___ _____ _ _
7+ | (_ / _ \ | || / _` / _ \ ' \ \__ \/ -_) '_\ V / -_) '_|
8+ \___\___/ \__/\__,_\___/_||_| |___/\___|_| \_/\___|_|
9+
10+ ```
211
312simple and quick golang JSON mock server
413
@@ -19,7 +28,7 @@ simple and quick golang JSON mock server
1928go install github.com/tkc/go-json-server
2029```
2130
22- ## Serve
31+ ## Serve Mock Server
2332``` bash
2433go-json-server
2534```
@@ -36,6 +45,12 @@ put api.json and run `go-json-server`
3645{
3746 " port" : 3000 ,
3847 " endpoints" : [
48+ {
49+ " method" : " GET" ,
50+ " status" : 200 ,
51+ " path" : " /" ,
52+ " jsonPath" : " ./health-check.json"
53+ },
3954 {
4055 " method" : " GET" ,
4156 " status" : 200 ,
@@ -56,12 +71,12 @@ put api.json and run `go-json-server`
5671}
5772```
5873
59- ` user.json `
74+
75+ ` health-check.json `
6076``` javascript
6177{
62- " id" : 1 ,
63- " name" : " name" ,
64- " address" : " address"
78+ " status" : " ok" ,
79+ " message" : " go-json-server started"
6580}
6681```
6782
Original file line number Diff line number Diff line change 11{
22 "port" : 3000 ,
33 "endpoints" : [
4+ {
5+ "method" : " GET" ,
6+ "status" : 200 ,
7+ "path" : " /" ,
8+ "jsonPath" : " ./health-check.json"
9+ },
410 {
511 "method" : " GET" ,
612 "status" : 200 ,
Original file line number Diff line number Diff line change 1+ {
2+ "status" : " ok" ,
3+ "message" : " go-json-server started"
4+ }
Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ func main() {
125125 }
126126}
127127
128+
128129func response (w http.ResponseWriter , r * http.Request ) {
129130
130131 r .ParseForm ()
You can’t perform that action at this time.
0 commit comments