msl-server

1.1.3 • Public • Published

MSL Build Status

MSL (pronounced 'Missile') stands for Mock Service Layer. Our tools enable quick local deployment of your UI code on Node and mocking of your service layer for fast, targeted testing.

Here is the link to getting started

Installation

Use the following command to install MSL Server

npm install msl-server

Use the following command to install MSL Server globally

npm install -g msl-server

Running MSL Server

Launching MSL Server for local installation

./node_modules/msl-server/bin/msl [options]

Launching MSL Server for global installation

msl [options]

Available options for MSL server

  • --port => specify the port that server will be listening on local host, default is 8000.
  • --basedir => specify the root directory(absolute path) of the app you want to launch locally, default is the directory where you run the command.
  • --debug => specify whether to output log in console or not, default is false.
  • --extensions => specify extension files you want to plugin to MSL to parse URL differently.

An example of how the options work

msl --basedir=/approot --port=8001 --debug=true

You can also use config file to include options for launching MSL server An example of how the config file works

msl msl.conf.js(*.conf.js)

Here is the template for config file

#!/usr/bin/env node
 
module.exports = {
    port: 8001,
    basedir: '.'
    debug: false,
    extensions: 'parseUrl.js'
};

And here is the template of the extension file

exports.customUrlParsing = function (options) {
      if (options.req.url.search('origURL')>0){
          var str = options.req.url
          var newUrl = str.replace('origURL','newUrl');
          options.res.writeHead(200, {'Content-Type': 'application/json','Access-Control-Allow-Origin':'*'});
          options.res.write('{"status":"url changed","message":"find the response with different url now"}');
      }
      else {
          options.res.writeHead(500, {'Content-Type': 'application/json','Access-Control-Allow-Origin':'*'});
          options.res.write('{"status":"error","message":"can not find response"}');
      }
};
 

Contributing

We encourage contribution from the open source community to help make MSL better. Please refer to the development page for more information on how to contribute to this project including sign off and the DCO agreement.

If you have any questions or discussion topics, please post them on Google Groups.

Building

Our project is built automatically on Travis-CI for all pull requests and merge requests.

Running Tests

After you checkout the code, execute E2E tests by running test/e2e-run.sh from the root folder. This script will:

  1. Install msl-server
  2. Start sample app using msl-server
  3. Build client
  4. Run unit tests

License Type

MSL project is licensed under Apache License Version 2.0

Readme

Keywords

none

Package Sidebar

Install

npm i msl-server

Weekly Downloads

1

Version

1.1.3

License

Apache 2.0

Unpacked Size

28.4 kB

Total Files

10

Last publish

Collaborators

  • bryantrobbins
  • finraoss
  • jacobsheppard
  • kood1
  • kuoc
  • warmachine64