change main export signature to localtunnel(port, opt, fn)

Makes for a simpler hello world app
This commit is contained in:
Roman Shtylman
2014-02-14 00:32:43 -05:00
parent 7217a08a05
commit 2f6f9459ad
5 changed files with 67 additions and 52 deletions

View File

@@ -25,15 +25,17 @@ var opt = {
subdomain: argv.subdomain,
}
var client = lt_client.connect(opt);
lt_client(opt.port, opt, function(err, tunnel) {
if (err) {
console.error(err);
return process.exit(1);
}
// only emitted when the url changes
client.on('url', function(url) {
console.log('your url is: %s', url);
});
console.log('your url is: %s', tunnel.url);
client.on('error', function(err) {
console.error(err);
tunnel.on('error', function(err) {
console.error(err);
});
});
// vim: ft=javascript