|
@@ -10,7 +10,6 @@ function PeerServer(options) {
|
|
|
EventEmitter.call(this);
|
|
|
|
|
|
this._app = restify.createServer();
|
|
|
- //this._app = express();
|
|
|
this._httpServer = this._app;
|
|
|
|
|
|
this._options = util.extend({
|
|
@@ -181,20 +180,14 @@ PeerServer.prototype._checkKey = function(key, ip, cb) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//This is where we change to restify
|
|
|
/** Initialize HTTP server routes. */
|
|
|
PeerServer.prototype._initializeHTTP = function() {
|
|
|
var self = this;
|
|
|
|
|
|
- //this._app.use(express.bodyParser());
|
|
|
+ this._app.use(restify.bodyParser({ mapParams: false }));
|
|
|
+ this._app.use(restify.queryParser())
|
|
|
this._app.use(util.allowCrossDomain);
|
|
|
-
|
|
|
- /*this._app.options('/*', function(req, res, next) {
|
|
|
- res.send(200);
|
|
|
- return next();
|
|
|
- });*/
|
|
|
|
|
|
-
|
|
|
// Retrieve guaranteed random ID.
|
|
|
this._app.get('/:key/id', function(req, res, next) {
|
|
|
res.contentType = 'text/html';
|
|
@@ -270,7 +263,7 @@ PeerServer.prototype._initializeHTTP = function() {
|
|
|
|
|
|
//this._app.post('/port', handle);
|
|
|
|
|
|
- // Listen on user-specified port and
|
|
|
+ // Listen on user-specified port.
|
|
|
this._httpServer.listen(this._options.port);
|
|
|
|
|
|
};
|