{"id":28406391,"url":"https://github.com/ddzyan/midway-practice","last_synced_at":"2025-06-29T07:32:32.803Z","repository":{"id":40365753,"uuid":"442118851","full_name":"ddzyan/midway-practice","owner":"ddzyan","description":"使用 midway + koa + ORM + Restful 接口基础功能，应用服务基础功能，做到业务开发开箱即用。","archived":false,"fork":false,"pushed_at":"2023-08-11T05:55:09.000Z","size":21000,"stargazers_count":50,"open_issues_count":2,"forks_count":18,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-02T07:16:43.340Z","etag":null,"topics":["nodejs","orm","prisma2","sequelize","swagger","typeorm","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ddzyan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-27T09:53:59.000Z","updated_at":"2024-12-17T07:03:13.000Z","dependencies_parsed_at":"2023-02-08T16:45:15.802Z","dependency_job_id":null,"html_url":"https://github.com/ddzyan/midway-practice","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ddzyan/midway-practice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddzyan%2Fmidway-practice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddzyan%2Fmidway-practice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddzyan%2Fmidway-practice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddzyan%2Fmidway-practice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ddzyan","download_url":"https://codeload.github.com/ddzyan/midway-practice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddzyan%2Fmidway-practice/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262556897,"owners_count":23328195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","orm","prisma2","sequelize","swagger","typeorm","typescript"],"created_at":"2025-06-01T22:11:13.471Z","updated_at":"2025-06-29T07:32:32.797Z","avatar_url":"https://github.com/ddzyan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 简介\n\n使用 midway + koa + ORM + Restful 接口基础功能，应用服务基础功能，做到业务开发开箱即用。\n\n实现功能：\n\n- 系统功能\n  - [x] 请求日志中间件\n  - [x] 统一响应中间件\n  - [x] 响应格式统一中间件\n  - [x] 定时任务\n  - [x] 请求参数验证\n  - [x] swagger 接入\n  - [x] JWT 验证\n  - [x] 添加通用工具类（日后拆除）\n  - [x] 增加 redis 相关配置\n  - [x] 封装 redis 工具类\n  - [x] 增加后台请求日志，保存到数据库中\n- ORM\n  - [x] 表结构生成\n  - [x] CRUD\n  - [x] 关联查询\n  - [x] 原始查询\n  - [x] query 日志\n  - [x] 事务\n- 部署\n  - [x] DockerFile 编写\n  - [x] docker-compose 编写\n  - [x] 生产环境部署优化\n- 单元测试\n  - [x] controller\n  - [x] service\n  - [x] task\n- 工程化\n  - [x] 添加 husky\n    - 提交检查 commit 格式，运行单元测试和代码格式检查\n\n## 使用\n\n执行 ./sql/test.sql 初始化数据库\n\n将 .env.local 文件重命名 .env 并且将配置修改正确\n\n```bash\nnpm i\n\nnpm run dev\n```\n\nswagger 文档地址：http://127.0.0.1:7001/swagger-ui/index.html\n\n## 根据数据库表快速生产 Midway Sequelize Entity\n\n```shell\n$ npx sequelize-auto-midway -h localhost -d yourDBname -u root -x yourPassword -p 13306  --dialect mysql -o ./src/app/entity --noInitModels true --caseModel c --caseProp c --caseFile c --indentation 1 -a ./additional.json\n```\n\nadditional.json\n\n```json\n{\n  \"timestamps\": true,\n  \"paranoid\": true\n}\n```\n\n具体请参考 [sequelize-auto-midway](https://github.com/happyNode/sequelize-auto-midway)\n\n## 生成数据库说明文件\n\n```shell\n$ npx db2md g -u root -p 3306 -pwd 123456 -h 127.0.0.1 test -o ./sql\n\n```\n\n# 更新记录\n\n- **[2022-12-06]**\n  - 优化 docker 打包启动失败问题\n- **[2022-12-06]**\n  - @midway 组件升级到 3.8.0，修改 sequelize 默认数据源获取方法\n  - 新增 serverTimeout 配置, 定义服务端超时时间。\n  - 去除 baseService getTransaction 方法\n- **[2022-11-18]** baseService 添加 createMany,count,getTransaction 方法\n- **[2022-11-17]** 添加自动化生产 Mysql 数据库表说明文件\n- **[2022-11-10]** 通用模块化，使用 happy-node-utils 集成\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddzyan%2Fmidway-practice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fddzyan%2Fmidway-practice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddzyan%2Fmidway-practice/lists"}