___ _ ___
/ __|___ _ | |__ _ ___ _ _ / __| ___ _ ___ _____ _ _
| (_ / _ \ | || / _` / _ \ ' \ \__ \/ -_) '_\ V / -_) '_|
\___\___/ \__/\__,_\___/_||_| |___/\___|_| \_/\___|_|
simple and quick golang JSON mock server.
simulate an http server and return the specified json according to a custom route.
- static json api server
- static file server
- cache response and reload
- change api.json path
- url param
- server deamon
- jwt or session auth
- error response
- access log
- E2E test sample source in Github Actions
$ go get -u github.com/tkc/go-json-server
- api.json // required
- response.json
See example
https://github.com/tkc/go-json-server/tree/master/example
$ go-json-server
api.json
{
"port": 3000,
"endpoints": [
{
"method": "GET",
"status": 200,
"path": "/",
"jsonPath": "./health-check.json"
},
{
"method": "GET",
"status": 200,
"path": "/users",
"jsonPath": "./users.json"
},
{
"method": "GET",
"status": 200,
"path": "/user/1",
"jsonPath": "./user.json"
},
{
"path": "/file",
"folder": "./static"
}
]
}
health-check.json
{
"status": "ok",
"message": "go-json-server"
}
users.json
[
{
"id":1,
"name": "name"
}
]
user.json
{
"id": 1,
"name": "name",
"address": "address"
}
MIT ✨