A simple http mock server implemented by Golang.
go get github.com/amooly/go-mocker
Firstly you need to create a json file to define the server config, just like this(You can also see the sample file here):
{
"server": {
"address": "0.0.0.0",
"port": 8080
},
"routes": [
{
"request": {
"method": "GET",
"url": "/hello"
},
"response": {
"status": 200,
"body": "{\"message\": \"World!\"}"
}
}
]
}
After Then, run the command. The format of go-mocker command is :
go-mocker [{path_to_mock_file}]
You can define your own file using absolute path or relative path. Or it will use the sample file
Inspired by go-http-mock-server