HTTP mock server, useful to stub services and simulate dynamic API responses with .net c# scripting
100K+
Where to get help and to file issues:
GitHub repository
Maintained by:
natenho
Mockaco is an HTTP-based API mock server with fast setup, featuring:
The default image ships with a sample "hello" mock:
$ docker run -it --rm -p 5000:5000 natenho/mockaco
Mockaco can be accessed by any HTTP client via http://localhost:5000
$ curl -iX GET http://localhost:5000/hello/docker
HTTP/1.1 200 OK
Date: Wed, 21 Jun 2019 05:10:00 GMT
Content-Type: application/json
Server: Kestrel
Transfer-Encoding: chunked
{
"message": "Hello docker!"
}
The best way to use the image is by creating a directory on the host system (outside the container) and mount this to the /app/Mocks directory inside the container.
/my/own/mockdir.mockaco container like this:$ docker run -it --rm -p 5000:80 -v /my/own/mockdir:/app/Mocks natenho/mockaco
The -v /my/own/mockdir:/app/Mocks part of the command mounts the /my/own/mockdir directory from the underlying host system as /app/Mocks inside the container, where Mockaco by default will read its mock JSON files.
PingPong.json under /my/own/mockdir folder:{
"request": {
"method": "GET",
"route": "ping"
},
"response": {
"status": "OK",
"body": {
"response": "pong"
}
}
}
$ curl -iX GET http://localhost:5000/ping
HTTP/1.1 200 OK
Date: Wed, 21 Jun 2019 05:10:00 GMT
Content-Type: application/json
Server: Kestrel
Transfer-Encoding: chunked
{
"response": "pong"
}
For advanced usage scenarios, like scripting and fake data generation, refer to the docs.
Content type
Image
Digest
sha256:e2bcd4935…
Size
51.1 MB
Last updated
about 1 year ago
docker pull natenho/mockaco