Преглед на файлове

enable "Deploy to Heroku" Button

Jonathan Johnson преди 10 години
родител
ревизия
bd101ab44f
променени са 4 файла, в които са добавени 14 реда и са изтрити 2 реда
  1. 3 1
      README.md
  2. 5 0
      app.json
  3. 4 0
      lib/server.js
  4. 2 1
      package.json

+ 3 - 1
README.md

@@ -6,9 +6,11 @@ PeerServer helps broker connections between PeerJS clients. Data is not proxied
 
 
 ##[http://peerjs.com](http://peerjs.com)
 ##[http://peerjs.com](http://peerjs.com)
 
 
-
 **If you prefer to use a cloud hosted PeerServer instead of running your own, [sign up for a free API key here](http://peerjs.com/peerserver)**
 **If you prefer to use a cloud hosted PeerServer instead of running your own, [sign up for a free API key here](http://peerjs.com/peerserver)**
 
 
+or
+
+[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy)
 
 
 ### Run PeerServer
 ### Run PeerServer
 
 

+ 5 - 0
app.json

@@ -0,0 +1,5 @@
+{
+  "name": "PeerJS Server",
+  "description": "A server side element to broker connections between PeerJS clients.",
+  "website": "http://peerjs.com/"
+}

+ 4 - 0
lib/server.js

@@ -212,6 +212,10 @@ PeerServer.prototype._initializeHTTP = function() {
 
 
   this._app.on('MethodNotAllowed', unknownMethodHandler);
   this._app.on('MethodNotAllowed', unknownMethodHandler);
 
 
+  this._app.get('/', function(req, res, next) {
+    res.send(require('../app.json'));
+  });
+
   // Retrieve guaranteed random ID.
   // Retrieve guaranteed random ID.
   this._app.get(this._options.path + ':key/id', function(req, res, next) {
   this._app.get(this._options.path + ':key/id', function(req, res, next) {
     res.contentType = 'text/html';
     res.contentType = 'text/html';

+ 2 - 1
package.json

@@ -26,6 +26,7 @@
     "node": ">=0.8"
     "node": ">=0.8"
   },
   },
   "scripts": {
   "scripts": {
-    "test": "mocha test"
+    "test": "mocha test",
+    "start": "bin/peerjs --port ${PORT:=9000}"
   }
   }
 }
 }