我要求:
//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弃用了,只是不确定它需要改为什么......
提前致谢!
答案 0 :(得分:1)
只需将var app = require('express')。createServer()替换为:
var express = require("express");
var app = express();