本项目是《纵横天下》修仙主题游戏的后端服务,提供用户管理、角色属性、任务系统等功能的API接口。
This project is the backend service for the "Zongheng Tianxia" cultivation-themed game, providing API interfaces for user management, character attributes, task systems, and other functions.
- Node.js
- Express
- MongoDB
- JWT (JSON Web Token)
houduan/
├── models/ # 数据模型
├── routes/ # 路由模块
├── controllers/ # 控制器逻辑
├── middleware/ # 中间件
├── config/ # 配置文件
├── scripts/ # 脚本文件
├── server.js # 服务器入口文件
└── .env # 环境变量配置
npm install
node scripts/initDb.js
npm start
开发模式启动 | Start in Development Mode:
npm run dev
POST /api/users/register
- 注册新用户POST /api/users/login
- 用户登录
GET /api/characters/:userId
- 获取角色信息PUT /api/characters/:userId
- 更新角色信息
GET /api/tasks
- 获取所有任务POST /api/tasks/complete
- 完成任务
在 .env
文件中配置以下环境变量:
Configure the following environment variables in the .env
file:
PORT=5000
MONGO_URI=mongodb://localhost:27017/zongheng-tianxia
JWT_SECRET=your_jwt_secret_key
yaoxiaolinglong (没工作在线要饭打钱)
- GitHub: https://github.com/yaoxiaolinglong
- Email: yaoxiaolinglong@foxmail.com