# rest-stub

> HTTP server which provides stubbed response

Latest version **1.0.0** (published 2014-11-06) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install rest-stub
pnpm add rest-stub
yarn add rest-stub
bun add rest-stub
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2014-11-06 |
| First published | 2014-11-06 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+5 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Alex Mikitik |
| Maintainers | mikattack |
| Keywords | rest, stub, utility |

## Links

- npm: https://www.npmjs.com/package/rest-stub
- Repository: https://github.com/mikattack/node-rest-stub
- Issues: https://github.com/mikattack/node-rest-stub/issues
- npm.io page: https://npm.io/package/rest-stub

## Dependencies (2)

- [express](https://npm.io/package/express.md) 4.10.1
- [body-parser](https://npm.io/package/body-parser.md) 1.9.2

## 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
- [facebook-ads-library-api](https://npm.io/package/facebook-ads-library-api.md) — 0 weekly downloads
- [@comp-markdown/wireframe](https://npm.io/package/@comp-markdown/wireframe.md) — 0 weekly downloads
- [generador-datos-mx](https://npm.io/package/generador-datos-mx.md) — 0 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2014-11-06

## README

# rest-stub

Simple web application which automatically responds to HTTP requests.

Often when creating applications which consume REST APIs, the resource endpoints don't yet exist or are somehow unavailable.  With this application, those requests can be pointed somewhere temporarily and provide real responses without the hassle of writing stubs.


## Available Endpoints

- **`/delay/[time]`** - A `200` response that is delayed by `[time]` seconds.
- **`/echo/[status]`** - A response of `[status]` status code with no content.  Prints request body to the console.
- **`/status/[status]`** - A response of `[status]` status code with no content.
- **`/wildcard/[percentage]`** - A response which randomly fails roughly `[percentage]` percent of the time.
- **`/[*]`** - Catch-all responder.  Will recognize two custom headers:
    + **`x-delay`** - Delays response by given integer.
    + **`x-status`** - Response will return with given status code (1xx - 5xx).


## Usage

```
npm install rest-stub
npm start
```

The application runs on port `48200`.

On OS X, a launch agent is included (if a little clunky to use):

1. Edit the `com.mikattack.rest-stub.plist` file and change the `/PATH/TO/server.js` string to point to where `rest-stub` was placed.
2. Copy `com.mikattack.rest-stub.plist` to `~/Library/LaunchAgents`.
3. Run `launchctl load ~/Library/LaunchAgents/com.mikattack.rest-stub.plist`

Check the *Console* application's output if the server doesn't seem accessible.

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