npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

msl-server

v1.1.3

Published

Web Server for MSL (Mock Service Layer)

Downloads

23

Readme

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