|
hace 15 horas | |
---|---|---|
.cursor | hace 1 mes | |
.vscode | hace 1 mes | |
public | hace 1 mes | |
src | hace 15 horas | |
test | hace 1 mes | |
typings | hace 1 mes | |
.cursorrules | hace 1 mes | |
.editorconfig | hace 1 mes | |
.eslintrc.json | hace 1 mes | |
.gitattributes | hace 1 mes | |
.gitignore | hace 1 mes | |
.prettierrc.js | hace 1 mes | |
Dockerfile | hace 1 mes | |
LICENSE | hace 1 mes | |
README.md | hace 3 días | |
bootstrap.js | hace 1 mes | |
docker-compose.yml | hace 1 mes | |
jest.config.js | hace 1 mes | |
package.json | hace 1 día | |
tsconfig.json | hace 1 mes |
一个基于 Cool Admin Midway 框架开发的现代化后端服务系统,提供完整的权限管理、用户管理、任务调度等功能。
moshiji_service/
├── src/
│ ├── comm/ # 通用工具库
│ ├── config/ # 配置文件
│ │ ├── config.default.ts # 默认配置
│ │ ├── config.local.ts # 本地开发配置
│ │ └── config.prod.ts # 生产环境配置
│ ├── modules/ # 业务模块
│ │ ├── base/ # 基础权限管理模块
│ │ │ ├── controller/ # 控制器
│ │ │ ├── entity/ # 实体类
│ │ │ ├── service/ # 服务层
│ │ │ ├── middleware/ # 中间件
│ │ │ └── dto/ # 数据传输对象
│ │ ├── user/ # 用户管理模块
│ │ ├── dict/ # 字典管理模块
│ │ ├── task/ # 任务调度模块
│ │ ├── plugin/ # 插件管理模块
│ │ ├── space/ # 空间管理模块
│ │ ├── recycle/ # 回收站模块
│ │ ├── demo/ # 示例模块
│ │ └── swagger/ # API文档模块
│ ├── configuration.ts # Midway配置
│ └── interface.ts # 类型声明
├── public/ # 静态资源
├── test/ # 测试文件
├── typings/ # 类型定义
├── bootstrap.js # 生产环境启动文件
└── package.json # 项目依赖
npm install
复制并修改配置文件:
# 本地开发环境
cp src/config/config.local.ts.example src/config/config.local.ts
# 生产环境
cp src/config/config.prod.ts.example src/config/config.prod.ts
在配置文件中设置数据库连接信息:
// src/config/config.local.ts
export default {
typeorm: {
dataSource: {
default: {
type: 'mysql',
host: 'localhost',
port: 3306,
username: 'root',
password: 'password',
database: 'moshiji_service',
synchronize: true,
logging: true,
},
},
},
};
# 开发环境
npm run dev
# 生产环境
npm run start
# 构建项目
npm run build
# 运行测试
npm run test
user_info.entity.ts
UserInfo
userName
/userInfo
而不是 /user/info
# 构建镜像
docker build -t moshiji-service .
# 运行容器
docker run -d -p 7001:7001 --name moshiji-service moshiji-service
# 启动服务
npm run pm2:start
# 停止服务
npm run pm2:stop
启动项目后,访问以下地址查看 API 文档:
http://localhost:7001/swagger-ui/index.html
http://localhost:7001/api-docs
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
注意: 本项目基于 Cool Admin Midway 框架开发,版本 8.x。请确保按照框架规范进行开发。