Nomming Peanut M&M's

    proxy-lite

    2014.8.27-10 • Public • Published

    proxy-lite

    lightweight nodejs proxy server with no external dependencies

    heroku.com test server



    build status travis.ci-org build status

    build commit status

    saucelabs.com selenium test status

    git branch test server test report coverage report build artifact
    master heroku.com test server test-report istanbul coverage report build artifacts
    beta heroku.com test server test-report istanbul coverage report build artifacts
    alpha heroku.com test server test-report istanbul coverage report build artifacts

    quickstart

    ## npm install proxy-lite
    npm install proxy-lite
    cd node_modules/proxy-lite
    ## start proxy server on port 8080
    npm start --server-port=8080
    

    library usage example

    // example.js
    /*jslint
      bitwise: true,
      indent:2,
      node: true
    */
    (function () {
      'use strict';
      var port, server, utility2;
      // require utility2 module
      try {
        utility2 = require('utility2');
      } catch (error) {
        utility2 = require('./main.js');
      }
      // create random port in the inclusive range 0x8000 - 0xffff
      port = (Math.random() * 0xffff) | 0x8000;
      console.log('proxy test server starting on random port ' + port);
      // init server with proxy middleware
      server = require('http').createServer(function (request, response) {
        utility2.serverMiddleware(request, response, function (error) {
          utility2.serverRespondDefault(response, error ? 500 : 404, error);
        });
      });
      // set server to listen on the specified port
      server.listen(port, function () {
        console.log('proxy test server started on port ' + port);
        setTimeout(function () {
          server.close();
          console.log('proxy test server closed after 1 second');
        }, 1000);
      });
    }());
    

    run npm test

    npm test
    

    description of files

    • .travis.yml
      • travis-ci config file
    • README.md
      • readme file
    • example.js
      • example nodejs script demonstrating how to use this app
    • main.data
      • data file containing embedded resources specific to this app
    • main.js
      • this app's main program / library
    • package.json
      • npm config file
    • utility2.data
      • data file containing embedded resources used by travis-ci
    • utility2.js
      • nodejs build script used by travis-ci
    • utility2.sh
      • shell build script used by travis-ci

    todo

    • flesh out proxy server code

    changelog

    2014.8.27

    • update to latest utility2 build code

    2014.7.2

    • autoload package.json
    • auto-reload utility2.data
    • add --repl-mode
    • fix test report time
    • automate heroku deployment in build
    • add test report badge
    • fix npm build
    • split subModuleBuildNodejs into subModuleBuildShared and subModuleBuildNodejs
    • split node-proxy-lite.js into node-proxy-lite.js and utility.js

    2014.7.1

    • initial commit

    Keywords

    none

    Install

    npm i proxy-lite

    DownloadsWeekly Downloads

    0

    Version

    2014.8.27-10

    License

    MIT

    Last publish

    Collaborators

    • kaizhu