Serving multiple mocks using a single Imposter docker container.
- Bash Shell
- Java 8
git clone https://github.com/fadc80/imposter-test.git && cd imposter-test
docker run -ti -p 8443:8443 -v $(pwd):/opt/imposter/config fadc80/imposter-rest
This project comes with three sample services:
Name | Script | URL |
---|---|---|
Service 1 | code 👁️ | http://localhost:8443/services/service1 |
Service 2 | code 👁️ | http://localhost:8443/services/service2 |
Service 3 | code 👁️ | http://localhost:8443/services/service3 |
For example, to call Service 1:
wget --server-response -qO - http://localhost:8443/services/service1
Output:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 58
{ "serviceId": "service1", "message": "Hello World!" }
New services can be added using this shell script:
chmod +x template.sh && ./template.sh service4
That's all!