Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行时环境,用于执行 JavaScript 代码 outside 浏览器。以下是一些关于 Node.js 文档的概述:

快速开始

要安装 Node.js,请访问 Node.js 官方网站

特性

  • 事件驱动:Node.js 使用非阻塞 I/O 模型,允许它同时处理大量并发连接。
  • 模块化:Node.js 使用 CommonJS 模块系统。
  • 跨平台:Node.js 支持多个操作系统。

资源

示例

const http = require('http');

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

server.listen(3000, () => {
  console.log('Server running at http://localhost:3000/');
});

图片

Node.js Logo

总结

Node.js 是一个强大的 JavaScript 运行时环境,适用于构建高性能、可扩展的网络应用程序。

了解更多关于 Node.js 的信息