GithubHelp home page GithubHelp logo

node-cocproxy's Introduction

node-CocProxy Build Status

Convention over Configuration Proxy written in Node.js.

If you access http://localhost:8087/http://example.com/script.js, then the proxy get following:

  1. if found <Current Directory>/example.com/script.js
    • access to <Current Directory>/example.com/script.js
  2. if not found
    • access to http://example.com/script.js

Installation

npm install -g cocproxy

Usage

Command Line

$ cocproxy [options]

Options:
  -h, --help         Show help.
  -v, --version      Outputs the version number.
  -d, --mock-file-dir path::String  Set mock file from this directory
  -p, --port Number  Set port number to thi proxy
  1. run $ cocproxy -p 8098
  2. set proxy url for browser
    • localhost:8098
  3. Access http://example.com/example.css

Node API

cocproxy.js

var CocProxy = require("cocproxy").CocProxy;
var options = {
    port : 8087,
    mockFileDir : "./"
}
var cocProxy = new CocProxy(options);
cocProxy.start();
// proxing
cocProxy.exit();

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT

node-cocproxy's People

Contributors

azu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

snaka

node-cocproxy's Issues

modify `<title>` during proxy

Sometimes, user confuse that the website is proxyed or not.
We want to improve this by modifng <title>.

Plain:

<title>example</title>

Proxy:

<title>example {cocproxy}</title>

pass host as command line arguments

Currently, require project/example.com/path/to/file for matching file.

return path.join(baseDir, urlObject.host, urlObject.pathname);

I want to specify example.com by command line argument instead of directory.

UseCase

When Alice is developing in alice.github.io and Bob is developing in bob.github.io, It it difference host between both.
So, I want to use command line argument instead of directory name for specifing host.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.