html页面
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<link rel="stylesheet" href="./index.css" />
</head>
<body>
<ul>
<li>张三</li>
<li>李四</li>
<li>王五</li>
</ul>
</body>
</html>
CSS样式
ul {
list-style: none;
}
JS
const http = require("http");
const fs = require("fs");
http
.createServer((req, res) => {
let buf = fs.readFileSync("./juhe/index.html");
res.write(buf);
res.end();
})
.listen(3000, () => {
console.log("服务器已启动");
});