# express-supermock

> Mock thrid party apis using superagent and express.

Latest version **1.0.3** (published 2023-02-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install express-supermock
pnpm add express-supermock
yarn add express-supermock
bun add express-supermock
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2023-02-14 |
| First published | 2021-02-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | unologin |
| Maintainers | adrian-kriegel |
| Keywords | supertest, superagent, express, mock, api |

## Links

- npm: https://www.npmjs.com/package/express-supermock
- Repository: https://github.com/unologin/express-supermock
- Homepage: https://github.com/unologin/express-supermock#readme
- Issues: https://github.com/unologin/express-supermock/issues
- npm.io page: https://npm.io/package/express-supermock

## Dependencies (4)

- [mocha](https://npm.io/package/mocha.md) ^9.1.3
- [express](https://npm.io/package/express.md) ^4.17.1
- [methods](https://npm.io/package/methods.md) ^1.1.2
- [supertest](https://npm.io/package/supertest.md) ^6.1.3

## Alternatives

- [pagerjs](https://npm.io/package/pagerjs.md) — 60 weekly downloads
- [whistle.savefor-mock](https://npm.io/package/whistle.savefor-mock.md) — 4 weekly downloads
- [@sandsoftwaresolutions/openapi-fixtures](https://npm.io/package/@sandsoftwaresolutions/openapi-fixtures.md) — 0 weekly downloads
- [mockupflo-mcp](https://npm.io/package/mockupflo-mcp.md) — 0 weekly downloads
- [mock-mcp-server](https://npm.io/package/mock-mcp-server.md) — 0 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2023-02-14
- 1.0.2 — 2021-11-26
- 1.0.1 — 2021-03-21
- 1.0.0 — 2021-02-21

## README

## express-supermock

Mock thrid party apis using superagent and express.

```javascript

// require or import
const { supermock, mock } = require('express-supermock');

// re-route all traffic from api.example.com to your mock implementation

// using an express app
mock('api.example.com', { app: myExpressApp });

// using an express router
mock('api2.example.com', { router: myExpressRouter });

// using just a simple callback
mock('api3.example.com', { handler: (req, res, next) => {...} });

```

Then use the ```supermock``` object like you would use [superagent](https://www.npmjs.com/package/superagent) or replace it using [proxyquire](https://www.npmjs.com/package/proxyquire). 

```javascript
// myModule's superagent will now re-route to your mock implementation
const myModule = proxyquire('my-module', { superagent: supermock });
```

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