node.js 简单实验 创建一个简单的web服务

概要:用一个最简单是例子感受一下node.js 的能力

1.代码

复制代码
var http = require("http")
http.createServer(function (request, response) {  
   response.writeHead(200, {'Content-Type': 'text/plain'});  
   response.end('Hello World\n');
}).listen(8081);
console.log('Server running at http://127.0.0.1:8081/');

2.运行结果

2.1 node t.js

1.2 http://127.0.0.1:8081

相关推荐
脱离语言18 分钟前
Jeecg3.8.2 前端经验汇总
开发语言·前端·javascript
NEXT0634 分钟前
useMemo 与 useCallback 的原理与最佳实践
前端·javascript·react.js
小爱丨同学35 分钟前
React-Context用法汇总 +注意点
前端·javascript·react.js
徐同保2 小时前
python如何手动抛出异常
java·前端·python
极客小云2 小时前
【实时更新 | 2026年国内可用的npm镜像源/加速器配置大全(附测速方法)】
前端·npm·node.js
半兽先生2 小时前
告别 AI 乱写 Vue!用 vue-skills 构建前端智能编码标准
前端·vue.js·人工智能
前端达人3 小时前
都2026年了,还在用Options API?Vue组合式API才是你该掌握的“正确姿势“
前端·javascript·vue.js·前端框架·ecmascript
Dxy12393102163 小时前
Python检查JSON格式错误的多种方法
前端·python·json
chao-Cyril4 小时前
从入门到进阶:前端开发的成长之路与实战感悟
前端·javascript·vue.js
shalou29014 小时前
Spring 核心技术解析【纯干货版】- Ⅶ:Spring 切面编程模块 Spring-Instrument 模块精讲
前端·数据库·spring