var http = require(‘http‘);var server = new http.createServer(handlerRequest(req,res));server.listen(8888);function handlerRequest(req,res){ res.end(‘hellow‘);}为什么报错说req未定义,createServer只接受匿名函数吗?
时间: 2024-10-10 13:30:15
var http = require(‘http‘);var server = new http.createServer(handlerRequest(req,res));server.listen(8888);function handlerRequest(req,res){ res.end(‘hellow‘);}为什么报错说req未定义,createServer只接受匿名函数吗?