running nodejs Times error res is not defined, please take a look at why?
var http = require("http")
var path = require("path")
var fs = require("fs")
var url = require("url")
var server = http.createServer(function(req, res){
var pathObj = url.parse(req.url, true)
console.log(pathObj)
console.log("~")
console.log(req)
})
fs.readFile("./hello.html",function(err,fileContent){
if(err){
console.log(404)
res.writeHead(404,"not found")
res.end()
}else{
res.writeHead(200, "OK")
console.log("OK")
res.write(fileContent)
res.end()
}
})
server.listen(8080)