Getting Started

Getting Started

Launch the service in 3 easy steps:

Download the latest docker image

docker pull apidoki/apimocker:v0.1

Create a basic config file

Create a directory / folder name apimocker under your working directory with: mkdir ./apimocker/, and create an example.json file with your favourite editor:

{
  "autoreload": true,
  "services": [
    {
      "port": 9876,
      "host": "0.0.0.0",
      "endpoints": [
        {
          "method": "GET",
          "route": "/test/",
          "behaviour": [],
          "content": {
            "source": "directory",
            "config": {
              "path": "/etc/apimocker/data"
            }
          }
        }
      ]
    }
  ]
}

Under your apimocker directory, create a subdirectory named data, and there you can place your files to be served.

Create a file ./example/data/foo.json with this content:

{ "foo": "bar" }

Run it

You are ready to run the image with:

docker run --rm -p 9876:9876 \
    -v ./apimocker:/etc/apimocker \
    apidoki/apimocker:v0.1 \
    /apimocker /etc/apimocker/example.json

and test it with a curl request:

curl http://localhost:9876/test/foo.json