# node-fake-api-server

> [![Build Status](https://travis-ci.org/jmather/node-fake-api-server.svg?branch=master)](https://travis-ci.org/jmather/node-fake-api-server) [![Sonarcloud Status](https://sonarcloud.io/api/project_badges/measure?project=jmather_node-fake-api-server&metric=

Latest version **0.1.5** (published 2019-05-04) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install node-fake-api-server
pnpm add node-fake-api-server
yarn add node-fake-api-server
bun add node-fake-api-server
```

Provides the command `fake-api-server`.

## 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.5 |
| Published | 2019-05-04 |
| First published | 2019-04-28 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 87.4 KB |
| Known vulnerabilities | 0 (+5 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | thejmather |

## Links

- npm: https://www.npmjs.com/package/node-fake-api-server
- Repository: https://github.com/jmather/node-fake-api-server
- Homepage: https://github.com/jmather/node-fake-api-server#readme
- Issues: https://github.com/jmather/node-fake-api-server/issues
- npm.io page: https://npm.io/package/node-fake-api-server

## Dependencies (9)

- [ajv](https://npm.io/package/ajv.md) ^6.10.0
- [btoa](https://npm.io/package/btoa.md) ^1.2.1
- [uuid](https://npm.io/package/uuid.md) ^3.3.2
- [debug](https://npm.io/package/debug.md) ~2.6.9
- [ngrok](https://npm.io/package/ngrok.md) ^3.1.1
- [morgan](https://npm.io/package/morgan.md) ~1.9.0
- [express](https://npm.io/package/express.md) ~4.16.0
- [concat-stream](https://npm.io/package/concat-stream.md) ^2.0.0
- [random-number-csprng](https://npm.io/package/random-number-csprng.md) ^1.0.2

## Recent versions

- 0.1.5 (latest) — 2019-05-04
- 0.1.3 — 2019-05-01
- 0.1.1 — 2019-05-01
- 0.1.0 — 2019-04-28

## README

# Fake API Server

[![Build Status](https://travis-ci.org/jmather/node-fake-api-server.svg?branch=master)](https://travis-ci.org/jmather/node-fake-api-server)
[![Sonarcloud Status](https://sonarcloud.io/api/project_badges/measure?project=jmather_node-fake-api-server&metric=alert_status)](https://sonarcloud.io/dashboard?id=jmather_node-fake-api-server)
[![Coverage Status](https://coveralls.io/repos/github/jmather/node-fake-api-server/badge.svg?branch=master)](https://coveralls.io/github/jmather/node-fake-api-server?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2f323f9700ab4e2eaed48f6e79355d70)](https://app.codacy.com/app/jmather/node-fake-api-server?utm_source=github.com&utm_medium=referral&utm_content=jmather/node-fake-api-server&utm_campaign=Badge_Grade_Dashboard)
[![DeepScan grade](https://deepscan.io/api/teams/2509/projects/5227/branches/40566/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=2509&pid=5227&bid=40566)

This tool allows you to register collections of arbitrary endpoints to mock responses for, allowing you to easily test your code end-to-end.

Pair with the [Fake API Client](https://github.com/jmather/node-fake-api-client) for easy collection registration.

View the [API Documentation](https://documenter.getpostman.com/view/4858910/S1LpZrgg#intro) to get a better idea of how to use the Fake API.

A server instance has been set up at [https://node-fake-api-server.herokuapp.com/](https://node-fake-api-server.herokuapp.com/).

## Schema

We have defined an [Open API Specification](/public/fake-api.openapi.yaml) as well as a detailed [JSON Schema](/public/fake-api-schema.json) of the request payloads.

## Usage

### Run Locally (Private)

```bash
npm install -g node-fake-api-server
fake-api-server
```

### Run Locally (Public)

```bash
npm install -g node-fake-api-server
fake-api-server --public
```

### Run In Code

```javascript
const http = require('http');
const app = require('node-fake-api-server');

const port = Math.floor(Math.random() * 2000) + 3000;

app.set('port', port);

const server = http.createServer(app);
server.listen(port);

server.on('listening', () => {
    // do stuff...
});
```

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