🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

miniproxy

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

miniproxy

Run a proxy that routes your different projects using their package.json files

0.1.3
latest
Source
npm
Version published
Weekly downloads
7
-56.25%
Maintainers
1
Weekly downloads
 
Created
Source

miniproxy

Run a proxy that routes your different projects using their package.json files.

Uses http-proxy as proxy engine.

How does it work?

miniproxy explores your apps directory (configurable) and opens each package.json file. If it finds a routes attribute, it will use it to configure the proxy. Once all the routing info has been gathered, the proxy starts to run.

A basic setup would be:

.
|_ proxy.js
|_ nodes_modules/
|   |_ miniproxy
|_ apps/
    |_ app1/
        |_ package.json
        |_ ...
    |_ app2/
        |_ package.json
        |_ ...
    |_ ...

Example of package.json containing a routes attributes:

{
    "name": "app1",
    "version": "0.1.0",
    "routes": {
        "app1.dev": "9001",
        "www.app1.dev": "9001"
    },
    "scripts": {
        "start": "app1.js"
    }
}

After reading this package.json file, miniproxy will route app1.dev and www.app1.dev hosts to localhost:9001.

How to use it

Install module:

npm install miniproxy

Use it (proxy.js file example):

// For each folder inside apps/ directory,
// extract routing info from package.json file
// then start a proxy with these routes on port 80
require('miniproxy').use(__dirname+'/apps').listen(80);

If you want to run your proxy continuously, you can use forever:

forever start proxy.js

Note that your apps are not started by miniproxy. You have to take care of it (launch them with forever may also be a good idea).

Keywords

proxy

FAQs

Package last updated on 05 May 2013

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