Coder Social home page Coder Social logo

h2non / rocky Goto Github PK

View Code? Open in Web Editor NEW
370.0 10.0 24.0 508 KB

Full-featured, middleware-oriented, programmatic HTTP and WebSocket proxy for node.js (deprecated)

License: MIT License

JavaScript 98.19% Shell 1.81%
http-proxy replay-requests middleware proxy replay gateway microservice forward-proxy forward balancer

rocky's People

Contributors

0xflotus avatar andresgottlieb avatar carsonmcdonald avatar dependabot[bot] avatar h2non avatar knpwrs avatar rootd00d avatar zaggino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rocky's Issues

Transform request per route

rocky
  .get('/users/:id')
  .toPath('/profile/:id')
  .headers({
     'X-API-Version': '1.0'
  })
  .forward('http://new.server')

Request reply shortcut method

Sometimes we don't wanna forward the request

proxy
  .get('/users/admin')
  .reply(401, { 'Content-Type': 'application/json' }, { message: 'Forbidden' })

Body intercept middleware filter

Support both regexp and filter function

route.transformBodyRequest(transformer, { filter: /application/json/ })
route.transformBodyRequest(transformer, { filter: function () { ... } })

rocky installable via PM2

Would be awesome to make rocky installable via PM2,

I recently embedded a npm install procedure + start with PM2 to make possible to install software easily by doing something like that:

$ pm2 install <npm-package-name>

There is a small documentation about the system

Tell me if you are interested to build a module like that, I can make modifications on the PM2 configuration system and related.

Improve middleware docs

Better API docs, usage example and explanation (injected fields in request, inversion of control...)

Issue while replaying request

In some scenarios, once the stream has been consumed and therefore the buffer is empty, it's not possible to replay the request with the proper payload.

Built-in request matching

A nice-to-have feature. Could be useful to discern the proxy behavior according to some specific request headers/params.

The API may look like this:

proxy.get('/users/:id')
  .match('X-Version', /^1.*/)
  .forward('http://old.server')
  .match('X-Version', /^2.*/)
  .forward('http://new.server')

Alternative implementation, using internally the router middleware

proxy.get('/users/:id', { 'X-Version', /^1.*/ }, function () { ... })
  .forward('http://google.es')

Internally it should be implemented via middleware

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.