技术实践
记录关于Egg.js如何使用自己开发的框架
这里说明,快速安装,里面的版本相对是低版本,应该是egg.js 官方没有去维护

安装项目
快速安装
shell
npm init egg --type=simple
npm i
这里说明,快速安装,里面的版本相对是低版本,应该是egg.js 官方没有去维护

逐步搭建安装
安装框架
shell
npm i egg-bag-framework
应用框架
json
"egg": {
"declarations": true,
"framework": "egg-bag-framework"
},
这样,所有依赖这个 Framework 的应用,都可以使用它提供的标准化能力和团队规范
egg-bag-framework
截止目前,我还在维护开发中,扩展功能
https://github.com/hangjob/egg-bag-framework
可能遇到的问题
redis链接不上

打开redis配置文件,修改如下,以空格分开

mysql拒绝连接

开启mysql允许访问ip访问,我本地是采用的windows宝塔面板管理,所以设置下即可

完整package.json
json
{
"name": "api",
"version": "1.0.0",
"description": "",
"private": true,
"egg": {
"declarations": true,
"framework": "egg-bag-framework"
},
"dependencies": {
"egg": "^3",
"egg-bag-framework": "^1.0.1",
"egg-scripts": "^2",
"egg-validate": "^2.0.2",
"i18n": "^0.15.1"
},
"devDependencies": {
"egg-bin": "^5",
"egg-ci": "^2",
"egg-mock": "^5",
"eslint": "^8",
"eslint-config-egg": "^12"
},
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"start": "egg-scripts start --daemon --title=egg-server-api",
"stop": "egg-scripts stop --title=egg-server-api",
"dev": "egg-bin dev",
"debug": "egg-bin debug",
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov"
},
"ci": {
"version": "16, 18",
"type": "github"
},
"repository": {
"type": "git",
"url": ""
},
"author": "",
"license": "MIT"
}