Running nodejs reports fewer errors ")"

clipboard.png

var http = require("http")
var server = http.createServer(function(req,res){
    console.log("jirengu")
    res.setHeader("Content-Type","text/plain";"charset=gbk")
    res.write("<h1>jirengu</h1>")
    res.end()
})
server.listen(9000)

says I"m missing parentheses. I can"t tell.

Feb.26,2021

here
clipboard.png


 res.setHeader("Content-Type","text/plain;charset=gbk")

res.setHeader ("Content-Type", "text/plain"; "charset=gbk")
commas are written in semicolons. Or write it in a string.
"text/plain";

there is a in the middle


you may need a code detection tool, such as eslint .

Menu