Files
whale-town-end/README.md

73 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Pixel Game Server
一个基于 NestJS 的 2D 像素风游戏后端服务
## 技术栈
- **NestJS** - 渐进式 Node.js 框架
- **TypeScript** - 类型安全
- **WebSocket** - 实时通信支持
## 前置要求
如果还没有安装 Yarn请先安装
```bash
npm install -g yarn
```
## 安装依赖
```bash
yarn install
```
## 开发
启动开发服务器(支持热重载):
```bash
yarn dev
```
服务器将运行在 `http://localhost:3000`
## 构建
```bash
yarn build
```
## 生产环境运行
```bash
yarn start:prod
```
## 项目结构
```
src/
├── api/ # API 接口层(控制器、网关)
├── config/ # 配置文件
├── data/ # 数据访问层(数据库、缓存)
├── model/ # 数据模型、实体、DTO
├── service/ # 业务逻辑层
├── utils/ # 工具函数
├── main.ts # 应用入口
├── app.module.ts # 根模块
├── app.controller.ts # 根控制器
└── app.service.ts # 根服务
test/
├── api/ # API 测试
└── service/ # 服务测试
```
## 下一步
-`src/api/` 目录下创建游戏相关的控制器和网关
-`src/model/` 目录下定义游戏数据模型
-`src/service/` 目录下实现游戏业务逻辑
- 使用 NestJS CLI 快速生成模块:`nest g module game`
- 添加 WebSocket 网关实现实时游戏逻辑