var http=require("http"); var message=[ "HelloWorld", "From a basic Node.js server", "Take Luck" ]; http.createServer((req,res)=>{ console.log("?"); res.setHeader("Content-Type","text/html"); res.writeHeader(200); res.write("<html><head><title>Simple Http Serever</title></head>"); res.write("<body>"); for(let i in message){ res.write(`\n<h1><mark>${message[i]}</mark></h1></mark>`); } res.end("\n</body></html>"); }).listen(8080);
时间: 2024-10-29 12:05:30