话不多说 上代码
没有加什么处理也不严谨 只为效果
const http=require('http'),
path=require('path'),
fs=require('fs')
//创建服务
let server=http.createServer((req,rep)=>{
fs.readFile(path.join(__dirname,'index.html'),'utf8',(err,con)=>{
//彭欣可以数据库读取
con=con.replace('$$name$$','彭欣')
console.log(con)
rep.writeHead(200,{'Content-Type':'text/html'})
rep.end(con)
})
console.log(req.method+'qqqqqq'+req.url)
})
server.listen(8080)
console.log(2222222222222)
const htt