h2non / rocky

Full-featured, middleware-oriented, programmatic HTTP and WebSocket proxy for node.js (deprecated)
MIT License
371 stars 24 forks source link

Support for Additional HTTP Methods #101

Closed alixaxel closed 8 years ago

alixaxel commented 8 years ago

I've a REST API that provides the following HTTP methods:

Method API Rocky
DELETE X X
GET X X
HEAD X X
OPTIONS X X
PATCH X X
POST X X
PURGE X
PUT X X
TRACE X

I would like to proxy all these through Rocky, but not all of them are available in the interface.

Additionally, OPTIONS is served directly from Rocky.

Is there an easy way of specifying additional HTTP methods to be proxied?

h2non commented 8 years ago

It's actually implemented was not not documented.

You can do:

proxy.route('PURGE', '/my/custom/path', optionalMiddleware)

I've just updated the docs to reflect this API method: https://github.com/h2non/rocky#rockyroutemethod-path--middleware-