Nodejs error res is not defined?

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)
Feb.28,2021

you may need to learn javascript first and then learn nodejs, fs.readFile there is no definition of res under the scope of the callback function.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be0653-46538.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be0653-46538.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?