来一个服务器
最简单的web服务器
const http = require("http");
const hostname = "127.0.0.1";
const port = 8080;
const server = http.createServer();
server.listen(port, hostname, function () {
console.log(`Server running at http://${hostname}:${port}/`);
});
server.on("request", function (req, res) {
res.setHeader("Content-type", "text/plain;charset=utf-8")
res.write("Hello World");
res.end();
});