<commit_before># Consumer Driven Contracts (CDC)

CDC provides a way to define mock provider for consumer (now) and verify contracts against provider (soon).
It is written in JavaScript, however can be run in any setup using docker.

## Getting started

### Using docker-compose
```yaml
version: '2'
services:
  api:
    build:
      context: .
    depends_on:
      - dependency
    ports:
      - "8080:8080"
    command: npm start
  mongo:
    image: mongo
    ports:
      - "27017:27017"
  dependency:
    image: uldissturms/cdc
    volumes:
      - ./contracts/dependency:/contracts
    command: mock
    ports:
      - "3000:3000"
```

Where ./contracts/dependency contains index.js that describes contract.
```
./contracts
└── dependency
    └── index.js
```

### Using docker
```
docker run -p 3000:3000 -v ${PWD}/lib:/contracts uldissturms/cdc mock ./contracts/simple-contract
```

### Using npm
```bash
npm i cdc<commit_msg>remove unnecessary details about mongo dep on api in readme<commit_after># Consumer Driven Contracts (CDC)

CDC provides a way to define mock provider for consumer (now) and verify contracts against provider (soon).
It is written in JavaScript, however can be run in any setup using docker.

## Getting started

### Using docker-compose
```yaml
version: '2'
services:
  api:
    build:
      context: .
    depends_on:
      - dependency
    command: npm start
  dependency:
    image: uldissturms/cdc
    volumes:
      - ./contracts/dependency:/contracts
    command: mock
    ports:
      - "3000:3000"
```

Where ./contracts/dependency contains index.js that describes contract.
```
./contracts
└── dependency
    └── index.js
```

### Using docker
```
docker run -p 3000:3000 -v ${PWD}/lib:/contracts uldissturms/cdc mock ./contracts/simple-contract
```

### Using npm
```bash
npm i cdc
{'fraction_non_alphanumeric': 0.1171960569550931, 'fraction_numerical': 0.028477546549835708, 'mean_word_length': 3.142857142857143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3414907', 'n_tokens_mistral': 641, 'n_tokens_neox': 562, 'n_words': 195}