Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 81 lines (55 sloc) 1.404 kb
0a8d54e James Halliday initial thing, seems to work
authored
1 bouncy
2 ======
3
4 Bouncy uses node's http parser innards to bounce http requests around to where
96c27c8 James Halliday note about transparency
authored
5 they need to go in an entirely transparent way.
0a8d54e James Halliday initial thing, seems to work
authored
6
7 Use bouncy as a load balancer or http host router.
8
9 example
10 =======
11
ff8c99e James Halliday route example
authored
12 route.js
13 --------
14
15 Route requests based on the host field
16
17 ````javascript
18 var bouncy = require('bouncy');
19
20 bouncy(function (req, bounce) {
21 if (req.headers.host === 'beep.example.com') {
22 bounce(8001);
23 }
24 else if (req.headers.host === 'boop.example.come') {
25 bounce(8002)
26 }
27 }).listen(8000);
28 ````
29
0a8d54e James Halliday initial thing, seems to work
authored
30 bounce.js
31 ---------
32
ff8c99e James Halliday route example
authored
33 Bounce all requests received on :8001 along to :8000
0a8d54e James Halliday initial thing, seems to work
authored
34
35 ````javascript
a7e9329 James Halliday absolute requires for the examples
authored
36 var bouncy = require('bouncy');
0a8d54e James Halliday initial thing, seems to work
authored
37
6509e8a James Halliday s/proxy/bounce/ in the example
authored
38 bouncy(function (req, bounce) {
67665b5 James Halliday simplified readme example to use the port sugar
authored
39 bounce(8000);
0a8d54e James Halliday initial thing, seems to work
authored
40 }).listen(8001);
41 ````
42
fe380a5 James Halliday documented the sugar and a bump to 0.0.1
authored
43 methods
44 =======
45
46 There is only one method, `bouncy(cb)`. Your callback `cb` will get these
47 arguments:
48
49 req
50 ---
51
52 The node http module request object.
53
54 bounce(stream)
55 --------------
56
57 Call this function when you're ready to bounce the request to a stream.
58
59 The exact request that was received will be written to `stream` and future
60 incoming data will be piped to and from it.
61
62 bounce(port), bounce(host, port)
63 --------------------------------
64
65 These variants of `bounce()` are sugar for
66 `bounce(net.createConnection(port))`
67 and
68 `bounce(net.createConnection(port, host))`.
69
0a8d54e James Halliday initial thing, seems to work
authored
70 install
71 =======
72
73 With [npm](http://npmjs.org), do:
74
75 npm install bouncy
76
77 license
78 =======
79
80 MIT/X11
Something went wrong with that request. Please try again.