0.1.5 • Published 5 years ago

node-fake-api-server v0.1.5

Weekly downloads
9
License
Apache-2.0
Repository
github
Last release
5 years ago

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...
});