0

我的要求:

//app.js Socket IO Test
var app = require('express').createServer(),
redis = require('socket.io/node_modules/redis'),
io = require('socket.io').listen(app);

我的错误:

Warning: express.createServer() is deprecated, express
applications no longer inherit from http.Server,
please use:
  var express = require("express");
  var app = express();

如何修改我的声明以避免此错误?我知道这种方法现在已被 Express 弃用,只是不确定需要将其更改为...

提前致谢!

4

1 回答 1

1

只需将 var app = require('express').createServer() 替换为:

var express = require("express");
var app = express();
于 2013-03-14T16:38:44.633 回答