node-fake-api-server
v0.1.5
Published
[![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=
Downloads
7
Readme
Fake API Server
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...
});