npm.io
0.1.5 • Published 7 years agoCLI

node-fake-api-server

Licence
Apache-2.0
Version
0.1.5
Deps
9
Size
87 kB
Vulns
5
Weekly
0
Stars
1

Fake API Server

Build Status Sonarcloud Status Coverage Status Codacy Badge DeepScan grade

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 for easy collection registration.

View the API Documentation 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/.

Schema

We have defined an Open API Specification as well as a detailed JSON Schema of the request payloads.

Usage

Run Locally (Private)
npm install -g node-fake-api-server
fake-api-server
Run Locally (Public)
npm install -g node-fake-api-server
fake-api-server --public
Run In Code
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...
});