正在显示
15 个修改的文件
包含
265 行增加
和
0 行删除
.autod.conf.js
0 → 100644
| 1 | +'use strict'; | |
| 2 | + | |
| 3 | +module.exports = { | |
| 4 | + write: true, | |
| 5 | + prefix: '^', | |
| 6 | + plugin: 'autod-egg', | |
| 7 | + test: [ | |
| 8 | + 'test', | |
| 9 | + 'benchmark', | |
| 10 | + ], | |
| 11 | + dep: [ | |
| 12 | + 'egg', | |
| 13 | + 'egg-scripts', | |
| 14 | + ], | |
| 15 | + devdep: [ | |
| 16 | + 'egg-ci', | |
| 17 | + 'egg-bin', | |
| 18 | + 'egg-mock', | |
| 19 | + 'autod', | |
| 20 | + 'autod-egg', | |
| 21 | + 'eslint', | |
| 22 | + 'eslint-config-egg', | |
| 23 | + ], | |
| 24 | + exclude: [ | |
| 25 | + './test/fixtures', | |
| 26 | + './dist', | |
| 27 | + ], | |
| 28 | +}; | |
| 29 | + | ... | ... |
.eslintignore
0 → 100644
| 1 | +coverage | ... | ... |
.gitignore
0 → 100644
.travis.yml
0 → 100644
README.md
0 → 100644
| 1 | +# hro-egg | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | +## QuickStart | |
| 6 | + | |
| 7 | +<!-- add docs here for user --> | |
| 8 | + | |
| 9 | +see [egg docs][egg] for more detail. | |
| 10 | + | |
| 11 | +### Development | |
| 12 | + | |
| 13 | +```bash | |
| 14 | +$ npm i | |
| 15 | +$ npm run dev | |
| 16 | +$ open http://localhost:7001/ | |
| 17 | +``` | |
| 18 | + | |
| 19 | +### Deploy | |
| 20 | + | |
| 21 | +```bash | |
| 22 | +$ npm start | |
| 23 | +$ npm stop | |
| 24 | +``` | |
| 25 | + | |
| 26 | +### npm scripts | |
| 27 | + | |
| 28 | +- Use `npm run lint` to check code style. | |
| 29 | +- Use `npm test` to run unit test. | |
| 30 | +- Use `npm run autod` to auto detect dependencies upgrade, see [autod](https://www.npmjs.com/package/autod) for more detail. | |
| 31 | + | |
| 32 | + | |
| 33 | +[egg]: https://eggjs.org | |
| \ No newline at end of file | ... | ... |
app.js
0 → 100644
| 1 | +module.exports = app => { | |
| 2 | + | |
| 3 | + app.once('server', server => { | |
| 4 | + | |
| 5 | + }) | |
| 6 | + | |
| 7 | + app.on('error', (err, ctx) => { | |
| 8 | + | |
| 9 | + }) | |
| 10 | + | |
| 11 | + app.on('request', ctx => { | |
| 12 | + | |
| 13 | + }) | |
| 14 | + | |
| 15 | + app.on('response', ctx => { | |
| 16 | + const used = Date.now() - ctx.starttime | |
| 17 | + console.log(used, 'used') | |
| 18 | + }) | |
| 19 | + | |
| 20 | + | |
| 21 | +} | |
| \ No newline at end of file | ... | ... |
app/controller/home.js
0 → 100644
app/router.js
0 → 100644
appveyor.yml
0 → 100644
config/config.default.js
0 → 100644
| 1 | +/* eslint valid-jsdoc: "off" */ | |
| 2 | + | |
| 3 | +'use strict'; | |
| 4 | + | |
| 5 | +const path = require('path') | |
| 6 | +/** | |
| 7 | + * @param {Egg.EggAppInfo} appInfo app info | |
| 8 | + */ | |
| 9 | +module.exports = appInfo => { | |
| 10 | + /** | |
| 11 | + * built-in config | |
| 12 | + * @type {Egg.EggAppConfig} | |
| 13 | + **/ | |
| 14 | + const config = exports = {}; | |
| 15 | + // use for cookie sign key, should change to your own and keep security | |
| 16 | + config.keys = appInfo.name + '_1642067379356_9612'; | |
| 17 | + | |
| 18 | + // add your middleware config here | |
| 19 | + config.middleware = []; | |
| 20 | + | |
| 21 | + // add your user config here | |
| 22 | + const userConfig = { | |
| 23 | + // myAppName: 'egg', | |
| 24 | + }; | |
| 25 | + | |
| 26 | + const view = { | |
| 27 | + root: path.join(appInfo.baseDir, 'app/public'), | |
| 28 | + defaultViewEngine: 'nunjucks', | |
| 29 | + mapping: { | |
| 30 | + '.html': 'nunjucks', | |
| 31 | + } | |
| 32 | + } | |
| 33 | + | |
| 34 | + config.cluster = { | |
| 35 | + listen: { | |
| 36 | + path: '', | |
| 37 | + port: 8001, | |
| 38 | + hostname: '0.0.0.0', | |
| 39 | + } | |
| 40 | + }; | |
| 41 | + | |
| 42 | + config.static = { | |
| 43 | + prefix: '', | |
| 44 | + dir: path.join(appInfo.baseDir, 'app/public'), | |
| 45 | + dynamic: true,//是否緩存靜態資源 | |
| 46 | + preload: false,//啓動項目開啓緩存 | |
| 47 | + maxAge: 0, //緩存時間 開發建議設0 跳坑 | |
| 48 | + buffer: false//是否緩存到内存 默認prod 緩存 | |
| 49 | + }; | |
| 50 | + | |
| 51 | + return { | |
| 52 | + ...config, | |
| 53 | + ...userConfig, | |
| 54 | + }; | |
| 55 | +}; | ... | ... |
config/config.prod.js
0 → 100644
config/plugin.js
0 → 100644
jsconfig.json
0 → 100644
package.json
0 → 100644
| 1 | +{ | |
| 2 | + "name": "hro-egg", | |
| 3 | + "version": "1.0.0", | |
| 4 | + "description": "", | |
| 5 | + "private": true, | |
| 6 | + "egg": { | |
| 7 | + "declarations": true | |
| 8 | + }, | |
| 9 | + "dependencies": { | |
| 10 | + "egg": "^2.15.1", | |
| 11 | + "egg-scripts": "^2.11.0" | |
| 12 | + }, | |
| 13 | + "devDependencies": { | |
| 14 | + "autod": "^3.0.1", | |
| 15 | + "autod-egg": "^1.1.0", | |
| 16 | + "egg-bin": "^4.11.0", | |
| 17 | + "egg-ci": "^1.11.0", | |
| 18 | + "egg-mock": "^3.21.0", | |
| 19 | + "eslint": "^5.13.0", | |
| 20 | + "eslint-config-egg": "^7.1.0" | |
| 21 | + }, | |
| 22 | + "engines": { | |
| 23 | + "node": ">=10.0.0" | |
| 24 | + }, | |
| 25 | + "scripts": { | |
| 26 | + "start": "egg-scripts start --daemon --title=egg-server-hro-egg", | |
| 27 | + "stop": "egg-scripts stop --title=egg-server-hro-egg", | |
| 28 | + "dev": "egg-bin dev", | |
| 29 | + "debug": "egg-bin debug", | |
| 30 | + "test": "npm run lint -- --fix && npm run test-local", | |
| 31 | + "test-local": "egg-bin test", | |
| 32 | + "cov": "egg-bin cov", | |
| 33 | + "lint": "eslint .", | |
| 34 | + "ci": "npm run lint && npm run cov", | |
| 35 | + "autod": "autod" | |
| 36 | + }, | |
| 37 | + "ci": { | |
| 38 | + "version": "10" | |
| 39 | + }, | |
| 40 | + "repository": { | |
| 41 | + "type": "git", | |
| 42 | + "url": "" | |
| 43 | + }, | |
| 44 | + "author": "", | |
| 45 | + "license": "MIT" | |
| 46 | +} | ... | ... |
请
注册
或
登录
后发表评论