# mocki

> [![npm version](https://badge.fury.io/js/mocki.svg)](https://badge.fury.io/js/mocki) [![Coverage Status](https://coveralls.io/repos/github/adalyte/mocki/badge.svg?branch=develop)](https://coveralls.io/github/adalyte/mocki?branch=develop)

Latest version **0.3.3** (published 2022-01-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install mocki
pnpm add mocki
yarn add mocki
bun add mocki
```

Provides the command `mocki`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.3 |
| Published | 2022-01-08 |
| First published | 2019-12-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 93.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 41 |
| Author | adalyte |
| Maintainers | keaeriksson |

## Links

- npm: https://www.npmjs.com/package/mocki
- Repository: https://github.com/adalyte/mocki
- Homepage: https://mocki.io
- Issues: https://github.com/adalyte/mocki/issues
- npm.io page: https://npm.io/package/mocki

## Dependencies (12)

- [fs](https://npm.io/package/fs.md) 0.0.1-security
- [yaml](https://npm.io/package/yaml.md) ^1.7.2
- [chalk](https://npm.io/package/chalk.md) ^3.0.0
- [faker](https://npm.io/package/faker.md) ^4.1.0
- [eslint](https://npm.io/package/eslint.md) ^7.5.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [express](https://npm.io/package/express.md) ^4.17.1
- [graphql](https://npm.io/package/graphql.md) ^15.3.0
- [supertest](https://npm.io/package/supertest.md) ^4.0.2
- [path-to-regexp](https://npm.io/package/path-to-regexp.md) ^6.1.0
- [command-line-args](https://npm.io/package/command-line-args.md) ^5.1.1
- [apollo-server-express](https://npm.io/package/apollo-server-express.md) ^2.16.1

## Recent versions

- 0.3.3 (latest) — 2022-01-08
- 0.3.2 — 2020-09-20
- 0.3.1 — 2020-09-19
- 0.3.0 — 2020-09-05
- 0.2.0 — 2020-08-23
- 0.1.6 — 2020-07-30
- 0.1.5 — 2020-03-18
- 0.1.4 — 2020-01-16
- 0.1.3 — 2019-12-12
- 0.1.2 — 2019-12-12
- 0.1.1 — 2019-12-12
- 0.1.0 — 2019-12-12

## README

# Mocki

[![npm version](https://badge.fury.io/js/mocki.svg)](https://badge.fury.io/js/mocki) [![Coverage Status](https://coveralls.io/repos/github/adalyte/mocki/badge.svg?branch=develop)](https://coveralls.io/github/adalyte/mocki?branch=develop)

Mocki is a tool that lets you create Mock REST and GraphQL APIs.

Support for

- Simulated failures
- Simulated delays
- Randomized reponses
- Conditional resposes
- Fake data generation

## Getting Started

1. Install Mocki `npm install -g mocki`
2. Create a config YAML-file using the structure in `.mocki/config.yml`

   Hello world example:

   ```
    name: mocki
    port: 3000
    endpoints:
      - path: /hello
        method: get
          responses:
            - statusCode: 200
              body:
                message: Hello from Mocki!
   ```

3. Start your mock by running `mocki run --path ./path/to/config.yml`
4. Test your mock by running
   `curl http://localhost:3000`
   ```
   { "message": "Hello World!" }
   ```

### Prerequisites

We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage Node versions

- `npm > 6`
- `node > 12`

### Documentation

Documentation is available at [Mocki.io](https://mocki.io/docs)

## Publishing a new version

1. Create tag from latest commit: `git tag vX.Y.Z`
2. Push tag: `git push origin vX.Y.Z`
3. Publish to npm: `npm publish`
4. Update coverage report: `npm run coverage`

---
_Source: https://npm.io/package/mocki · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
