我正在尝试以下代码,但它给了我一个错误,"res.send不是一个函数".请帮我.
这是代码:
var http = require('http');
var fs = require('fs');
var connect = require('connect');
var express = require('express');
var app = express();
app.get('/', function(res, req ) {
res.send('Hello World');
});
var server = app.listen(8888, function(){
var host = server.address().address;
var port = server.address().port;
console.log("Example app listening at http://%s:%s", host, port);
});
Run Code Online (Sandbox Code Playgroud)
服务器正常运行并正在连接.显示的完整错误是这样的:
TypeError:res.send不是c:\ wamp\www \node\server.js中的函数:8:13在Layer.handle [as handle_request](c:\ wamp\www \node \node_modules\express\lib \路由器\ layer.js:95:5)在Route.dispatch(c:\ wamp\www \)下一步(c:\ wamp\www \node \node_modules\express\lib\router\route.js:137:13) node \node_modules\express\lib\router\route.js:112:3)在Layer.handle [as handle_request](c:\ wamp\www \node \node_modules\express\lib\router\layer.js:95: 5)在c:\ wamp\www \node \node_modules\express\lib\router\index.js:281:22 at Function.process_params(c:\ …