localhost:8888并没有输出页面的代码

来源:3-3 CORS跨域限制以及预请求验证

慕UI4716311

2018-09-16

const http= require(‘http’)
const fs=require(‘fs’)
http.createServer(function(request, response){

console.log('request come', request.url)
const html=fs.readFileSync('hello.html','utf8')
response.writeHead(200,{
    'Conten-Type':'text/plain'
})
response.end(html)

}).listen(8888)

console.log(‘server listening on 8888’)

写回答

1回答

Jokcy

2018-09-17

那输出了啥?

0
1
sunny_乐
我的也是,而且控制台还报错了。所以页面显示无法访问此网站。
2018-09-25
共1条回复

HTTP协议原理+实践 完整案例解析主流技术

解析HTTP协议原理 夯实HTTP技术基础 打通前后端助你快速成长

4313 学习 · 375 问题

查看课程