nodejs 报错 求解答

//服务器模块
var http=require('http');
var url=require('url');
function start(route,handle){

function onRequest(request,response){
    var pathname=url.parse(request.url).pathname;
    console.log('request for'+pathname+' recieved');
    route(handle,pathname,response);
}
http.createServer(onRequest).listen(8888);
console.log('http server start');

}
exports.start=start;

//程序处理模块
var exec=require('child_process').exec;
function start(response){

console.log("Request handler 'start' was called.");
exec('ls-lah',function(error,stdout,stderr){
    response.writeHead(200,{'Content-Type':'text/plain'});
    response.write(stdout);
    response.end();
});

}
function upload(response){

console.log("Request handler 'upload' was called.");
response.writeHead(200,{'Content-Type':'text/plain'});
response.write('Hello World');
response.end();

}
exports.start=start;
exports.upload=upload;

//路由模块
function route(handle,pathname,response){

console.log('About to route a request for'+pathname);
if(typeof handle[pathname]==='function'){
    handle[pathname](response);
}else{
    console.log('No request found for '+pathname);
    response.writeHead(404,{'Content-Type':'text/plain'});
    response.write('404 Not Found');
    response.end();
}

}
exports.route=route;

//主文件
var server=require('./server');
var router=require('./routes');
var requestHandlers=require('./requestHandler');
var handle={};
handle['/']=requestHandlers.start;
handle['/start']=requestHandlers.start;
handle['/upload']=requestHandlers.upload;

server.start(router.route,handle);

以上为对照教程的程序原代码,结果我这边会有报错,报错如图

已邀请:

jacsondct

赞同来自:

报错不是说的挺明白的,495行的没有读到正确的 caseSensitive, 这个属性你找找存不存在。

要回复问题请先登录注册