1.0.0 • Published 7 years ago

wo v1.0.0

Weekly downloads
7
License
BSD-3-Clause
Repository
github
Last release
7 years ago

#wo

Dynamic balancing proxy handler plugin for hapi.js, based on h2o2. Uses the SWIM algorithm, see rjrodger/sneeze

NOTE: 1.x is Promise-based and requires hapi >= 17.x.

Quick Example

// base.js - run a base node to bootstrap SWIM network
require('sneeze')({base:true}).join()

// web.js - web server that proxies
var hapi = require('hapi')
var server = new hapi.Server()

server.connection({ 
  port: 8000 // test with http://localhost:8000/api/ping
})

server.register(require('wo'),console.log)
  
server.route({ 
  method: 'GET', path: '/api/ping', 
  handler: {
    wo: {} // look ma - no config!
  }
})

server.start(console.log)

// pingA.js - content server behind web.js
var hapi = require('hapi')
var server = new hapi.Server()

server.connection({ 
  port: 8001 // this is the magic - SWIM will inform web.js about this port
})

// join SWIM network, advertising route
server.register({
  register:require('wo'),
  options:{
    route: { path: '/api/ping' },
  }
},console.log)


// actual content
server.route({ 
  method: 'GET', path: '/api/ping', 
  handler: function( req, reply ){
    reply({a:1})
  }})

server.start(console.log)
1.0.0

7 years ago

0.10.0

7 years ago

0.9.0

8 years ago

0.8.0

9 years ago

0.7.0

10 years ago

0.6.0

10 years ago

0.5.0

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.0

12 years ago