1.0.1 • Published 7 years ago

beavertool-proxy-server v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

June 15, 2017.

Description.

"beavertool-proxy-server" is a small front end development helper which

    - clones web site including *.js files
    - requests to different web sites can be handled differently
    - intercepts database ajax calls and handles them in custom-made
      JavaScript application, beapp.js


1.  Look for the browser-proxy-remote-site diagram in the file
    "backend-server.js". Look for node-dependencies there.

2.  Express.js posed to us problems ... apperntly saving both binary
    and text files in the same session.
    
    The current solution with "native-vanilla" node.js libraries
    worked better.

Installation.

(if no parent project exists yet, do 
    npm init
)

from repository:
    npm install --save-dev beavertool-proxy-server
from file:
    npm install --save-dev beavertool-proxy-server-root.tar

Usage

There are two parts coming from installation package.

1. module core files:
   node_modules/beavertool-proxy-server/beavertool-proxy-server.js
   node_modules/beavertool-proxy-server/beavertool-proxy-server/do-save-path.js

2. test application:
   beavertool-proxy-server/test.js 
   
   copy this file into node-project root and run as
   node test.js
   then land your web browser on localhost:8086/

   modify test.js file for your needs

3. for more sofisticated use, see a template
   beavertool-proxy-server/app

Restrictions.

    The cloning of the site works only for "simple" sites.

    Which means for sites which do not have explicit
    "domain" in "domain"/"path" requests.

    The "domain" prefix is set right in configuration file,
    test.js, and initial path, aka index.html, is typed
    in address bar in the web browser by user.

    In other words, all of the calls from the browser to
    this site do use only relative part, "path".

    There is no protection against malformed "path"s
    inside web page. 
    For example, "path" = /../../../xxx.html may create file
    outside of node project which is insecure.

    In particular, if JavaScript will assembly "domain"/"path"
    token and request it, then request will bypass this proxy.


    To make this proxy real "master", set web-browser settings
    to its IP:port like in
    https://askubuntu.com/questions/513840/google-chrome-proxy-settings 

Installation.

npm install --save-dev cookie
...

Publishing this project

help: https://www.guru99.com/node-js-modules-create-publish.html


This is a sample from GitHub:

    start state: 
        new repository,
        lancelab/dev-proxy-server.git,
        created on GitHub, but the project
        is not checked in locally and no .git initialized
        under this project yet

    #create .gitignore if not yet done
    git init
    git add .
    git commit -m "first commit"
    git remote add origin https://github.com/lancelab/dev-proxy-server.git
    git push -u origin master

…or push an existing repository from the command line

    git remote add origin https://github.com/lancelab/dev-proxy-server.git
    git push -u origin master



$ npm publish
    + beavertool-proxy-server@1.0.0
    stan@ubu:/var/www/html/sand/dev/platforms/nodejs/creating-node-modules/beavertool-proxy-server-root$ 
1.0.1

7 years ago

1.0.0

7 years ago