Explorar o código

Update to express 4.x

lmb %!s(int64=10) %!d(string=hai) anos
pai
achega
33c4f0b01b
Modificáronse 2 ficheiros con 5 adicións e 2 borrados
  1. 3 1
      lib/server.js
  2. 2 1
      package.json

+ 3 - 1
lib/server.js

@@ -1,5 +1,6 @@
 var util = require('./util');
 var express = require('express');
+var bodyParser = require('body-parser');
 var WebSocketServer = require('ws').Server;
 var url = require('url');
 
@@ -133,7 +134,8 @@ app._checkKey = function(key, ip, cb) {
 app._initializeHTTP = function() {
     var self = this;
 
-    this.use(express.bodyParser({ mapParams: false }));
+    this.use(bodyParser.urlencoded({extended: true}));
+    this.use(bodyParser.json());
     this.use(util.allowCrossDomain);
 
     // Retrieve guaranteed random ID.

+ 2 - 1
package.json

@@ -13,7 +13,8 @@
   "author": "Michelle Bu, Eric Zhang",
   "license": "MIT",
   "dependencies": {
-    "express": "~3.5.1",
+    "body-parser": "^1.9.0",
+    "express": "^4.9.8",
     "optimist": "~0.6.1",
     "utils-merge": "~1.0.0",
     "ws": "~0.4.25"