0.0.24 • Published 10 years ago

pylon v0.0.24

Weekly downloads
47
License
-
Repository
github
Last release
10 years ago

pylon (experimental)

     ___________________________
    /             _             \
    |   ___  _ _ | | ___  ___   |
    |  | . || | || || . ||   |  |
    |  |  _||_  ||_||___||_|_|  |
    |  |_|  |___|               |
    \_________________________  / ____       ___
                              \| / .  \  .-´/   \`-.
                                 \____ \/   \___/   \__
                                      \_`---´___`---´-´
                                       /../..\ /..\..\
  • portmanager with dnode-interface
  • inspired by seaport - maybe you should use seaport!

cli

TBA

api

var pylon = require('pylon')()
pylon.config()
pylon.listen()
pylon.connect()
pylon.set()
pylon.get()
pylon.del()
pylon.subscribe()
pylon.unsubscribe()
pylon.use()

plumbing

package.json

{ "name" : "my-balancer" 
, "version" : "0.0.0"
, "dependencies" : 
  { "pylon" : "*" 
  , "pylon-balancer" : "*"
  , "pylon-web" : "*"
  }
, "scripts" :
  { "start-balancer" : "node ./balancer.js &"
  , "start-app" : "node ./app.js &"
  , "test" : "curl http://localhost:9901/ -H 'Host:foo.bar.com'"
  }
}

balancer.js

var balancer = require('pylon-balancer')
var web      = require('pylon-web')
var pylon    = require('pylon')
balancer().listen(1334).connect(1337) 
web().listen(1335).connect(1337)
pylon().listen(1337)

// or: 
// var dnode = require('dnode')
// var pylonServer = dnode(pylon).listen(1337)
// pylonServer.on('ready',function(){
//   dnode().connect(1337,function(remote,conn){
//     dnode(balancer(remote)).listen(1334)
//     dnode(web(remote)).listen(1335)
//   })
// })

app.js

var express = require('express')
  , app = express.createServer()
  , port = Math.floor(Math.random() * 40000 + 10000)
  , pylon = require('pylon')
app.get('/',function(req,res){
  res.end('hello! i am actually running on port: '+port)
})
app.listen(port,function(){
  pylon.connect(1337,function(remote,conn){
    remote.set
      ( { port: port, host: 'localhost' }
      , { balancer : 
          { route  : 'foo.bar.com'
          , weight : 10 }
        , permanent : true
        } 
      , function(err, data) {
          if (err) return console.error(err)
          console.log(data)
        } 
      )
  })
})
0.0.24

10 years ago

0.0.23

11 years ago

0.0.22

11 years ago

0.0.21

11 years ago

0.0.20

11 years ago

0.0.19

12 years ago

0.0.18

12 years ago

0.0.17

12 years ago

0.0.0

12 years ago