Sign inSign up

unlockd/stub-server

By unlockd

•Updated almost 9 years ago

Docker image to create a stub server using stubby npm package

Image
0

4.0K

unlockd/stub-server repository overview

⁠Usage

⁠Create endpoint configuration file

Create endpoint config yml file (Example⁠) in your project stub folder eg: myProjectStubDir/data.yml

Reference: https://github.com/mrak/stubby4node⁠

⁠Create stub response files

Create stub response json files in your project stub folder (Example⁠)

⁠Start container
⁠docker-compose.yml
version: '2'
services:
  stub:
    image: unlockd/stub-server
    volumes:
      - "myProjectStubDir:/stub"
    ports:
      - 8882:8882
      - 8889:8889
    environment:
      - STUB_DATA=/stub/data.yml
      - ADMIN_PORT=1234 #optional, default 8889
      - STUB_PORT=5678 #optional, default 8882
⁠Run command
docker-compose up -d stub

# access http://localhost:1234/status to view the stub configurations
# access http://localhost:5678/users to get the stub response
⁠Change stubs

When changing stub response json files, the stub response is updated automatically

When changing endpoint config yml file, run docker-compose restart stub

When changing docker composer file, run

docker-compose stop stub \
&& docker-compose rm -f stub \
&& docker-compose up -d stub

Tag summary

Content type

Image

Digest

Size

23.6 MB

Last updated

almost 9 years ago

docker pull unlockd/stub-server