Spaces:
Running
Running
| title: Chatroom | |
| emoji: 🐨 | |
| colorFrom: red | |
| colorTo: pink | |
| sdk: docker | |
| pinned: false | |
| # Node.js 聊天室(无依赖) | |
| 这是一个最小可用的聊天室示例:服务端使用 Node.js 内置 `http`,消息推送使用 SSE(Server-Sent Events),不需要安装任何 npm 依赖。 | |
| ## 本地运行 | |
| ```bash | |
| npm start | |
| ``` | |
| 然后打开: | |
| http://localhost:3000 | |
| ## 接口 | |
| - `GET /events?username=xxx`:SSE 消息流(加入/离开/消息) | |
| - `POST /message`:发送消息(JSON:`{ "username": "xx", "text": "hello" }`) | |
| - `GET /healthz`:健康检查 | |