创建服务过程中你可能忽视的bug:
- createServer(),单词不要写错
- res.end(data),参数要写data
- __dirname + “/assets/clock.html”,绝对路径要能连起来,如果不确定可以打印,不停的打印
- data is not defined, data的位置不对,找到错误的地方并修改
- require()是发起请求并执行, createServer()是创建服务,on request 箭头函数,比较复杂,所有函数细节都在这里面
- 写代码之前想一下逻辑再写,先写框架再写细节
- 封装函数的方式: const handleFileByUrl=(url,contentType)=>{details}