下载:

http://nodejs.cn/download/

安装后,打开cmd 输入:node 验证是否安装成功!


helloworldDemo

新建: 保存为:example.js文件

const http = require('http');

const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World\n');
});

server.listen(port, hostname, () => {
  console.log(`服务器运行在 http://${hostname}:${port}/`);
});

运行: 查看:

nodejs下载及helloworld!




相关文章:

  • 2021-08-23
  • 2022-02-08
  • 2021-11-19
  • 2021-07-20
  • 2021-11-11
  • 2022-01-28
  • 2021-10-08
  • 2021-07-15
猜你喜欢
  • 2021-06-03
  • 2021-04-15
  • 2021-04-05
  • 2021-10-23
  • 2021-07-17
相关资源
相似解决方案