Skip to content

Commit

Permalink
updated the service example with secret and semver
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Feb 9, 2012
1 parent 27e6fdd commit 964d009
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ server.js:

``` js
var seaport = require('seaport');
var ports = seaport.connect('localhost', 9090);
var ports = seaport.connect('localhost', 9090, { secret : 'beep boop' });
var http = require('http');

var server = http.createServer(function (req, res) {
res.end('beep boop\r\n');
});

ports.service('http server', function (port, ready) {
ports.service('web@1.2.3', function (port, ready) {
server.listen(port, ready);
});
```
Expand All @@ -42,10 +42,10 @@ client.js:

``` js
var seaport = require('seaport');
var ports = seaport.connect(9090);
var ports = seaport.connect(9090, { secret : 'beep boop' });
var request = require('request');

ports.get('http server', function (ps) {
ports.get('web@1.2.x', function (ps) {
var u = 'http://' + ps[0].host + ':' + ps[0].port;
request(u).pipe(process.stdout);
});
Expand Down
4 changes: 2 additions & 2 deletions example/service/client.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var seaport = require('../../');
var ports = seaport.connect('localhost', 9090);
var ports = seaport.connect('localhost', 9090, { secret : 'beep boop' });
var request = require('request');

ports.get('http', function (ps) {
ports.get('web@1.2.x', function (ps) {
var u = 'http://' + ps[0].host + ':' + ps[0].port;
request(u).pipe(process.stdout);
});
4 changes: 2 additions & 2 deletions example/service/server.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
var seaport = require('../../');
var ports = seaport.connect('localhost', 9090);
var ports = seaport.connect('localhost', 9090, { secret : 'beep boop' });
var http = require('http');

var server = http.createServer(function (req, res) {
res.end('beep boop\r\n');
});

ports.service('http', function (port, ready) {
ports.service('web@1.2.3', function (port, ready) {
server.listen(port, ready);
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name" : "seaport",
"description" : "service registry and port assignment for clusters",
"version" : "0.4.1",
"version" : "0.5.0",
"repository" : {
"type" : "git",
"url" : "git://github.com/substack/seaport.git"
Expand Down

0 comments on commit 964d009

Please sign in to comment.