dmitrisweb / raml-mocker-server

Node module to run server mocking API described in RAML files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

raml-mocker-server

Node module to run server mocking API described in RAML files

Objective

This plugin make use of raml-mocker module. It run a Express server and configure endpoints and responce from RAML files.

How to use

Basic, this will create server on port 3030

var api = require('raml-mocker-server');

var options = {
    path: 'test/raml' // path to folder with RAML files
};

var callback = function (app){
	// Express app could be used to configure more paths
    console.log('All RAML files parsed and API endpoints defined');
};

// returns created server
var server = api(options, callback);

Add API to existing web server:

Options

Name Type Default value Description
port number 3030 defines server port
path string 'raml' path to raml folder, relative to the execution context
prefix string, array '' prefixing all API endpoints described in RAML
debug boolean enable logging debug info to the console
watch boolean enable watching on RAML files
staticPath string defines path to the static folder
prioritizeBy string 'schema' defines the priority of the endpoint response if both 'schema' and 'example' are defined
app object if server already exists you can pass express app, Express app, no need to specify port and staticPath

About

Node module to run server mocking API described in RAML files

License:MIT License


Languages

Language:JavaScript 76.8%Language:RAML 23.2%