function onRequest(request, response, modules) {
var a = require('http');
a.createServer(function (req, res) {
req.setEncoding('utf8');
var postData = "";
req.addListener("data", function (chunk) {
postData += chunk;
});
req.addListener("end", function () {
var resp = function (ret, status_code) {
res.writeHead(status_code, {
"Content-Type": "text/plain; charset=utf-8"
});
res.end(ret);
}
});
}).listen(8080, "0.0.0.0");
}
require()
是nodejs
的内置函数,如果是在nodejs
环境下运行时不存在这个问题的https://nodejs.org/dist/latest-v5.x/docs/api/http.html1.使用了未定义的函数
2.代码不太全,看错误提示,找出错误行,然后仔细的核对