当我在http.createServer
中使用node.js
时,发生了以下错误。
Uncaught TypeError: http.createServer is not a function
server.js的代码在下面给出
var http = require('http');
var url = require('url');
function start(route) {
var onRequest = function (request, response) {
route(request, response);
};
http.createServer(onRequest).listen(8888);
console.log('Server has started');
}
exports.start = start;