猿问
如何用nodejs打开项目中的html文件?
初学者,如何用node在项目下打开index.html?
呼啦一阵风
浏览 2487
回答 1
1回答
湖上湖
使用node.js的文件系统读取html的内容再使用response.sendFile对请求进行相应. var fs = require('fs'); response.sendFile(fs.readFileSync('index.html','UTF-8'));
0
0
0
随时随地看视频
慕课网APP
相关分类
JavaScript
我要回答