未捕获的TypeError:http.createServer不是函数

时间:2017-04-19 09:30:34

标签: javascript node.js

当我在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;

0 个答案:

没有答案