Skip to content

Commit 7d85c12

Browse files
committed
add documentation
1 parent b1331a6 commit 7d85c12

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,50 @@
11
# pigato-proxy
22
A pigato proxy to foward a request from a broker to another
3+
4+
This can be used as a module or as a standalone binary
5+
6+
#Standalone Binary
7+
8+
##Installation
9+
```npm i -g pigato-proxy```
10+
11+
##Usage
12+
```
13+
Usage: pigato-proxy [options]
14+
15+
Options:
16+
17+
-h, --help output usage information
18+
-V, --version output the version number
19+
-s, --source [endpoint] Source Endpoint
20+
-ss, --sourceservice [service] Source Service
21+
-d, --destination [endpoint] Destination Endpoint
22+
-ds, --destinationservice [service] Destination Service [sourceservice]
23+
```
24+
25+
#Node.JS module
26+
27+
```javascript
28+
var PigatoProxy = require('pigato-proxy');
29+
30+
var endpoint = 'tcp://127.0.0.1:55000';
31+
32+
var proxy = new PigatoProxy( endpoint , { proxy : { remote : tcp://127.0.0.1:55001 , service : '/foo'});
33+
proxy.start(function(){ console.log('started')});
34+
```
35+
36+
###Autostart
37+
If we give a callback to the constructor, then the proxy will be automatically started
38+
39+
```javascript
40+
PigatoProxy( endpoint , { proxy : { remote : tcp://127.0.0.1:55001 , service : '/foo'}, function(){ console.log('started')});
41+
```
42+
43+
###Service Forward
44+
Moreover, we can also change the name of the service requested.
45+
This can be usefull to dynamically linked two services even if servicename are hard coded
46+
47+
```javascript
48+
PigatoProxy( endpoint , { proxy : { remote : tcp://127.0.0.1:55001 , service : { in :'/foo' , out : '/bar' }, function(){ console.log('started')});
49+
50+
```

0 commit comments

Comments
 (0)