# egg-ts-Sequelize **Repository Path**: LGXAK/egg-ts-sequelize ## Basic Information - **Project Name**: egg-ts-Sequelize - **Description**: orm+node+ts+egg - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2022-05-01 - **Last Updated**: 2023-12-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 主要技术栈 ``` nodejs, egg, typescript, sequelize(ORM框架) redis ``` ### 快速开始 ``` npm install ``` - 开发环境启动 ``` npm run dev ``` - 生产环境启动 ``` npm run tsc npm start ``` ### Npm Scripts - Use `npm run lint` to check code style - Use `npm test` to run unit test - se `npm run clean` to clean compiled js at development mode once ### Requirement - Node.js 8.x - Typescript 2.8+ orm框架 egg 方便理解的教程 egg 官方文档 在EggJS中使用Sequelize做联表查询 https://juejin.cn/post/6844903842367143950 ## 项目结构 ``` ├── app │ └── controller # 控制层对service层操作 | └── extend # 对application、context、request、response、helper对象进行自定义拓展,进一步加强框架的功能 | └── lib # 依赖文件夹,写工具 接口路由注入token鉴权 | └── middleware # 中间件 | └── model # 数据库的表模型 | └── service # 对数据库表操作sql | └── validate # 校验字段使用的文件夹 ├── config # 配置数据库 ├── sql # 数据库脚本 ├── upload # 上传文件夹 ├── README.md ``` ## 项目开发流程 ``` 写模型modal数据库表实体-》service服务层操作sql逻辑 -》写控制controller逻辑 ``` ### Config 运行前需要创建并填写正确的配置 其他环境请遵循config.{env}.ts格式命名 ``` eggts/config/config.default.ts // 默认配置 eggts/config/config.local.ts // 本地配置 eggts/config/config.prod.ts // 生产配置 ``` ## sequelize-cli - 初始化 Migrations 配置文件和目录 ``` npx sequelize init:config npx sequelize init:migrations npx sequelize init:seeders ```