ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
创建web服务器 ~~~ //引用系统模块 const http = require('http') ; //创建web服务器 const app = http. createServer () ; //当客户端发送请求的时候 // 修 rep(请求 请求地址 请求对象) res (响应对象 对接收的内容 做出 回复) app.on( ' request',(req, res) => { //响应 res.end('<h1>hi, user</h1>') ; }) ; //监听3000端口 app.listen(3000) ; console.log( '服务器已启动,监听3000端口,请访问localhost:3000') ~~~ nodemon app.js (启动 运行 代码 这个可以一直运行) node app.js (运行代码 一次性) ![](https://img.kancloud.cn/2d/33/2d33be230ed28760622f1a54147dbc84_1885x559.png)