📜  在节点 js 中托管 html - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:22.046000             🧑  作者: Mango

代码示例1
var http = require('http');
var fs = require('fs');
var index = fs.readFileSync('index.html');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end(index);
}).listen(9615);