New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

msl-server

Package Overview
Dependencies
Maintainers
6
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msl-server

Web Server for MSL (Mock Service Layer)

latest
Source
npmnpm
Version
1.1.3
Version published
Maintainers
6
Created
Source

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:

  • Install msl-server
  • Start sample app using msl-server
  • Build client
  • Run unit tests

License Type

MSL project is licensed under Apache License Version 2.0

FAQs

Package last updated on 05 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts