Explorar o código

Update README and script to accept path

Michelle Bu %!s(int64=11) %!d(string=hai) anos
pai
achega
2983739725
Modificáronse 2 ficheiros con 8 adicións e 4 borrados
  1. 2 2
      README.md
  2. 6 2
      bin/peerjs

+ 2 - 2
README.md

@@ -28,7 +28,7 @@ Or, create a custom server:
 
 ```javascript
 var PeerServer = require('peer').PeerServer;
-var server = new PeerServer({ port: 9000 });
+var server = new PeerServer({port: 9000, path: '/myapp'});
 ```
 
 Connecting to the server from PeerJS:
@@ -36,7 +36,7 @@ Connecting to the server from PeerJS:
 ```html
 <script>
     // No API key required when not using cloud server
-    var peer = new Peer('someid', {host: 'localhost', port: 9000});
+    var peer = new Peer('someid', {host: 'localhost', port: 9000, path: '/myapp'});
 </script>
 ```
 

+ 6 - 2
bin/peerjs

@@ -49,7 +49,11 @@ var path = require('path')
       port: {
         demand: true,
         alias: 'p',
-        description: 'port',
+        description: 'port'
+      },
+      path: {
+        demand: false,
+        description: 'custom path'
       }
     }).argv;
 
@@ -67,5 +71,5 @@ process.on('uncaughtException', function(e) {
 
 var server = new PeerServer(opts);
 console.log(
-  "Started PeerServer, port: " + opts.port + (" (v. %s)"), version
+  'Started PeerServer, port: ' + opts.port + ', path: ' + (opts.path || '/') + (" (v. %s)"), version
 );