# connect-mock

> Connect middleware for easy file based API mocking

Latest version **0.1.0** (published 2014-02-07) · 0 weekly downloads

## Install

```sh
npm install connect-mock
pnpm add connect-mock
yarn add connect-mock
bun add connect-mock
```

## 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.1.0 |
| Published | 2014-02-07 |
| First published | 2014-02-07 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 0.10.x |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | VTEX |
| Maintainers | gadr90 |

## Links

- npm: https://www.npmjs.com/package/connect-mock
- Repository: https://github.com/vtex/connect-mock
- Issues: https://github.com/vtex/connect-mock/issues
- npm.io page: https://npm.io/package/connect-mock

## Recent versions

- 0.1.0 (latest) — 2014-02-07

## README

connect-mock
============

![Build status](https://travis-ci.org/vtex/connect-mock.png)

Connect middleware for easy file-based API mocking

### Usage

First, add files containing your API mock responses to a `mock` directory.
Then, `require` it and call it as a function, passing options.

    mock = require('connect-mock')
    options = {
        mockDirectory: 'mocks/',
        verbose: false
    }
    middlewares.push[mock(options)]

**Important:** If you expect an answer from a endpoint which collides with a directory,
you can use a file with the same name as the directory. See examples in `mock/` folder.

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