0
var http = require('http');
var fs = require('fs');
var html = fs.readFileSync('./index.html');

http.createServer(function (req, res) {
  if (req.method == 'POST') {
    req.pipe(process.stdout);
    res.writeHead(200, {'Content-Type': 'text/plain'});
    req.pipe(res);
  }
  else {
    res.writeHead(200, {'Content-Type': 'text/html'});
    res.end(html);`enter code here`
  }
}).listen(8080);
4

0 回答 0