创建app.js文件:

var http = require('http');
http.createServer(function (req, resp) {
resp.writeHead(200, {'Content-Type': 'text/plain'});
resp.end('Hello, World!\n');
}).listen(8124, '127.0.0.1');
console.log('Server running at http://127.0.0.1:8124');

运行:

$ node app.js
Server running at http://127.0.0.1:8124

打开浏览器:

Hello, world! (Node.js)




相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
  • 2021-05-17
  • 2021-04-18
  • 2021-12-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2021-11-27
  • 2022-02-27
相关资源
相似解决方案