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

refox

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

refox

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

refox

<br /><br />Lightweight mock server on top of <a href="https://github.com/koajs/koa">koa</a>

npm build David Gitter license

Installation

$ npm i refox -g

Setup

Step 1: create config file in your project root

refox.config.js

const path = require( 'path' );

module.exports = {
	port: 5000,
	verbose: true,
	debug: true,
	mock: {
		sync: {
			test: function( url, req ) {
				if( /sync/.test( url ) ) {
					return true;
				}
			},
			resolve: function( url, req ) {
				// sync return
				return '{ "foo": "bar" }';
			}
		},
		async: {
			test: function( url, req ) {
				if( /async/.test( url ) ) {
					return true
				}
			},
			resolve: function( url, req ) {
				// or async callback
				var cb = this.async();
				setTimeout(function() {
					cb( '123' );
				}, 1000);
			}
		},
	},
	compile: [
		{
			test: function( url, req ) {
				if( /sync/.test( url ) ) {
					return true;
				}
			},
			loaders: [
				'pug?root=' + path.resolve( __dirname, 'fixtures/views' )
			],
			// find your local file
			local: function( url, req ) {
				return path.resolve( __dirname, 'fixtures/views/test.pug' );
			}
		}
	],
	static: [
		'lib'
	]
}

Step 2: run refox

$ refox

you can also specify config file by using

$ refox -c file.config.js

CLI

Usage: refox [options]

lightweight mock server on top of koa

Options:

  -h, --help           output usage information
  -V, --version        output the version number
  -c, --config <path>  specify config file path
  -d, --debug          enable debug mode

License

MIT © fengzilong

FAQs

Package last updated on 12 Sep 2016

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