The tiniest HTTP endpoints simulator
Download your binary here
On terminal
$ endpoints
Or, if you are into containers
On terminal
$ docker run ghcr.io/alexrios/endpoints:latest
You should see
INFO[0000] [GET] / -> 200 with body -> customBody.json
INFO[0000] Listen at :8080
- address - ":8080"
- method - "GET"
- latency - 0ms
- status code - 200
All features example:
{
"address": ":8080",
"responses": [
{
"path": "/",
"status": 201,
"latency": "400ms",
"method": "POST",
"json_body": "customBody.json"
}
]
}
Note: json_body is the file location of the body file.
Now you want to interpolate an identifier on the response body. How to do it?
Let's add another response on responses
.
{
"address": ":8080",
"responses": [
{
"path": "/",
"status": 200,
"latency": "400ms",
"method": "POST",
"json_body": "customBody.json"
},
{
"path": "/{id}/sales",
"status": 201,
"latency": "400ms",
"method": "GET",
"json_body": "interpolated.json"
}
]
}
And now, we'll use templating notation to use this response body as a template.
{
"id": {{ .id}}
}
This project is under development.