Docker compose

version: '3'
services:
  httpstub:
    image: ghcr.io/gleb619/httpstub:master
    ports:
      - "9080:9080"
    environment:
      - SERVER_PORT=9080
      - STUB_DATA=data
      - WATCH_INTERVAL=3
      - WATCH_ENABLED=true
    volumes:
      - ./stubs:/app/data

Execute next commands

mkdir -p stubs
cat <<EOT >> stubs/hello.world.yaml
version: v1.1
rules:
  - request:
      path: /api/greetings
    response:
      status: 200
      headers:
        content-type: application/json
      body: |
        {
          "message": "Hello World!"
        }
EOT
docker-compose up -d

Once the project is up, you can open http://localhost:9080/api/greetings and see the result

Last updated