Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rocky

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rocky - npm Package Compare versions

Comparing version 0.3.0-beta.1 to 0.3.0

test/dispatcher.js

11

lib/base.js

@@ -90,8 +90,7 @@ const MwPool = require('./mwpool')

if (!this._interceptResponse) {
this._interceptResponse = true
this.use(middleware.responseBody(function (req, res, next) {
this.mw.run('response', req, res, next)
}.bind(this)))
}
if (this._interceptResponse) return this
this.use(middleware.responseBody(function (req, res, next) {
this.mw.run('response', req, res, next)
}.bind(this)))
this._interceptResponse = true

@@ -98,0 +97,0 @@ return this

const Dispatcher = require('./dispatcher')
const middleware = ['forward', 'replay', 'response']
const events = [

@@ -12,3 +14,3 @@ 'error', 'proxyReq', 'proxyRes',

module.exports = function handler(rocky, route) {
exports = module.exports = function routeHandler(rocky, route) {
const dispatcher = new Dispatcher(rocky, route)

@@ -22,7 +24,8 @@

return function handle(req, res) {
dispatcher.dispatch(req, res)
}
return dispatcher.dispatch.bind(dispatcher)
}
exports.events = events
exports.middleware = middleware
function propagateEvents(rocky, route) {

@@ -38,3 +41,3 @@ events.forEach(function (event) {

function propagateMiddleware(rocky, route) {
['forward', 'replay'].forEach(function (type) {
middleware.forEach(function (type) {
route.useFor(type, function (req, res, next) {

@@ -41,0 +44,0 @@ rocky.mw.run(type, req, res, next)

{
"name": "rocky",
"version": "0.3.0-beta.1",
"version": "0.3.0",
"description": "Featured, middleware-oriented HTTP/S proxy with traffic replay and intercept",

@@ -5,0 +5,0 @@ "repository": "h2non/rocky",

@@ -55,10 +55,10 @@ # rocky [![Build Status](https://api.travis-ci.org/h2non/rocky.svg?branch=master&style=flat)](https://travis-ci.org/h2non/rocky) [![Code Climate](https://codeclimate.com/github/h2non/rocky/badges/gpa.svg)](https://codeclimate.com/github/h2non/rocky) [![NPM](https://img.shields.io/npm/v/rocky.svg)](https://www.npmjs.org/package/rocky) ![Downloads](https://img.shields.io/npm/dm/rocky.svg)

- Nested configuration per global/route and forward/replay phases
- Hierarchial middleware layer supporting the different HTTP traffic flow phases
- Hierarchial middleware layer supporting different HTTP traffic flow phases
- Able to run as standalone HTTP/S server (without connect/express)
- Compatible with most of the existing connect/express middleware
- Versatible programmatic control for dynamic configurations with zero-downtime
- Compatible with most of the existent connect/express middleware
- Powerful programmatic control supporting dynamic configurations and zero-downtime
- Supports both concurrent and sequential HTTP traffic flow modes
- Small hackable core designed for extensibility
- Fluent, elegant and evented programmatic API
- Simple [command-line interface](https://github.com/h2non/rocky-cli) with declarative configuration file
- Fluent, elegant and evented [programmatic API](#programmatic-api)
- Simple [command-line interface](https://github.com/h2non/rocky-cli) with declarative [configuration file](#configuration-file)

@@ -77,3 +77,2 @@ ## When `rocky` can be useful?

- As embedded HTTP proxy in your node.js app
- As static response HTTP server
- As HTTP cache or log server

@@ -101,13 +100,15 @@ - As SSL terminator proxy

`rocky` design is driven by keeping versatility and extensibility in mind.
The main goal is to remain it with a small core and codebase, hosting just the proper responsability and necessary built-in features, and making more efforts providing ways for extensibility.
That level extensibility can be covered via its middleware layer, which is the core and more powerful feature of `rocky`.
`rocky` design is driven by keeping versatility and extensibility in mind with small core.
Extensibility feature is covered via the middleware layer, which is the core and more powerful feature of `rocky`.
The relevant difference between the middleware layer and a common event bus (which is very common in asynchronous programming) is the control flow capability.
Via the middleware you can completely rely on a consistent control flow when performing some actiong with the HTTP traffic flow, continuing or stoping it accordingly.
This approach allows you to plug in intermediate jobs with custom logic beetwen different stages of the HTTP flow live cycle.
The significant difference between the middleware layer and a common event bus is the control flow capability.
Via the middleware you can completely rely on a consistent control flow to perform actions with the HTTP traffic flow, modifying, continuing or stopping it accordingly, for both incoming/outgoing flows.
This allows you to plug in intermediate jobs with custom logic beetwen different phases of the HTTP flow live cycle.
`rocky` middleware layer is based on `connect` middleware, and it's mostly compatible with existent middleware for `connect`/`express`.
### Stability
rocky is relative young, but production focused project actively maintained and improved.
Version `0.1.x` was wrote during my free time in less than 10 days (mostly at night during the weekend), therefore it can be considered in `beta` stage.

@@ -131,3 +132,3 @@

|==============|
| The Internet |
| HTTP clients |
|==============|

@@ -705,2 +706,6 @@ ||||

#### route#timeout(miliseconds)
Define a custom timeout for forward/replay traffic in miliseconds.
#### route#toPath(url, [ params ])

@@ -963,1 +968,3 @@

MIT - Tomas Aparicio
[![views](https://sourcegraph.com/api/repos/github.com/h2non/rocky/.counters/views.svg)](https://sourcegraph.com/github.com/h2non/rocky)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc