请打开一个文本编辑器,创建一个新的JavaScrip文件,例如命名为`server.js`,然后在该文件中输入以下代码:
```javascrip// 引入 hp 模块cos hp = require('hp');
// 定义服务器处理程序fucio hadleReques(req, res) { // 设置响应头 res.wrieHead(200, { 'Coe-Type': 'ex/hml' });
// 生成文章内容 cos aricle = ` u003chmlu003e u003cheadu003e u003cileu003e我的文章u003c/ileu003e u003c/headu003e u003cbodyu003e u003ch1u003e欢迎来到我的网站!u003c/h1u003e u003cpu003e这是一篇由 JavaScrip 生成的文章。你可以通过访问我们的 u003ca href= `;
// 将文章内容写入响应 res.ed(aricle);}
// 创建服务器并监听端口cos server = hp.creaeServer(hadleReques);server.lise(3000, () =u003e { cosole.log('服务器已启动,监听端口 3000');});```这段代码创建了一个简单的Web服务器,当有人访问该服务器时,它将返回一个HTML页面,页面包含一个、一段文字和一个链接。