Commit 883d130d authored by 李尚科's avatar 李尚科

init

parent 1598fe9b
'use strict';
module.exports = {
write: true,
prefix: '^',
plugin: 'autod-egg',
test: [
'test',
'benchmark',
],
dep: [
'egg',
'egg-scripts',
],
devdep: [
'egg-ci',
'egg-bin',
'egg-mock',
'autod',
'autod-egg',
'eslint',
'eslint-config-egg',
'webstorm-disable-index',
],
exclude: [
'./test/fixtures',
'./dist',
],
};
{
"extends": "eslint-config-egg"
}
logs/
npm-debug.log
yarn-error.log
node_modules/
package-lock.json
yarn.lock
coverage/
.idea/
run/
.DS_Store
*.sw*
*.un~
typings/
.nyc_output/
sudo: false
language: node_js
node_js:
- '8'
install:
- npm i npminstall && npminstall
script:
- npm run ci
after_script:
- npminstall codecov && codecov
# 业务中心
# 51business
51business
## QuickStart
......
'use strict';
const Controller = require('egg').Controller;
class HomeController extends Controller {
async index() {
const { ctx } = this;
ctx.body = 'hi, egg';
}
}
module.exports = HomeController;
'use strict';
/**
* @param {Egg.Application} app - egg application
*/
module.exports = app => {
const { router, controller } = app;
router.get('/', controller.home.index);
};
environment:
matrix:
- nodejs_version: '8'
install:
- ps: Install-Product node $env:nodejs_version
- npm i npminstall && node_modules\.bin\npminstall
test_script:
- node --version
- npm --version
- npm run test
build: off
/* eslint valid-jsdoc: "off" */
'use strict';
/**
* @param {Egg.EggAppInfo} appInfo app info
*/
module.exports = appInfo => {
/**
* built-in config
* @type {Egg.EggAppConfig}
**/
const config = {};
// use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + '_1554705194320_9697';
// add your middleware config here
config.middleware = [];
// add your user config here
const userConfig = {
// myAppName: 'egg',
};
return config;
};
'use strict';
module.exports = appInfo => {
const config = exports = {};
config.debug = true;
// use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + '_1554705194320_9697';
// 是否启用csrf安全
config.security = {
csrf: {
enable: false,
},
domainWhiteList: [],
};
exports.multipart = {
// 不用steam用file
mode: 'file',
// will append to whilelist
fileExtensions: [
// images
'.jpg',
'.jpeg', // image/jpeg
'.png', // image/png, image/x-png
'.gif', // image/gif
'.bmp', // image/bmp
'.wbmp', // image/vnd.wap.wbmp
'.webp',
'.tif',
'.psd',
'.xlsx',
'.xls',
],
};
config.sequelize = {
datasources: [
{
// 东八时区
timezone: '+08:00',
delegate: 'blockModel',
baseDir: 'model/block',
// other sequelize configurations
dialect: 'mysql',
host: 'rm-bp1mnwmta5778y0d3jo.mysql.rds.aliyuncs.com',
database: 'poseidon_dev',
username: 'kf_liuhaihua',
password: '24u1GaFh96khR31T7zs2y',
port: 3306,
},
],
};
config.redis = {
client: {
port: 6379,
host: '116.62.55.137',
password: 'DEV8redis',
db: 0,
},
};
exports.oss = {// sdfsdfsd
client: {
accessKeyId: 'LTAIxEMB8ucstyi8',
accessKeySecret: 'sCVJSCPyfaSIlS5R8fH4Xl77yHKR3z',
bucket: '51shequ',
endpoint: 'oss-cn-hangzhou.aliyuncs.com',
timeout: '60s',
},
};
return config;
};
'use strict';
// had enabled by egg
// exports.static = true;
exports.jwt = {
enable: true,
package: 'egg-jwt',
};
exports.mysql = {
enable: true,
package: 'egg-mysql',
};
exports.sequelize = {
enable: true,
package: 'egg-sequelize',
};
exports.oss = {
enable: true,
package: 'egg-oss',
};
exports.validate = {
enable: true,
package: 'egg-validate',
};
exports.redis = {
enable: true,
package: 'egg-redis',
};
exports.routerPlus = {
enable: true,
package: 'egg-router-plus',
};
exports.oss = {
enable: true,
package: 'egg-oss',
};
exports.sessionRedis = {
enable: true,
package: 'egg-session-redis',
};
{
"name": "51business",
"version": "1.0.0",
"description": "处理用户业务公共逻辑",
"private": true,
"dependencies": {
"dataloader": "^1.4.0",
"egg": "^2.2.1",
"egg-cors": "^2.1.1",
"egg-jwt": "^3.1.2",
"egg-mysql": "^3.0.0",
"egg-onerror": "^2.1.0",
"egg-oss": "^2.0.0",
"egg-redis": "^2.0.0",
"egg-router-plus": "^1.3.0",
"egg-scripts": "^2.5.0",
"egg-sequelize": "^4.1.0",
"egg-session-redis": "^2.1.0",
"egg-validate": "^2.0.1",
"emoji": "^0.3.2",
"moment": "^2.22.2",
"mysql2": "^1.6.1",
"node-cache": "^4.2.0",
"parameter": "^3.3.1",
"ramda": "^0.25.0",
"uuid": "^3.3.2"
},
"devDependencies": {
"autod": "^3.0.1",
"autod-egg": "^1.0.0",
"egg-bin": "^4.3.5",
"egg-ci": "^1.8.0",
"egg-mock": "^3.14.0",
"eslint": "^4.11.0",
"eslint-config-egg": "^6.0.0",
"webstorm-disable-index": "^1.2.0"
},
"engines": {
"node": ">=8.9.0"
},
"scripts": {
"start": "egg-scripts start --port=10011 --daemon --title=egg-server-51business",
"stop": "egg-scripts stop --title=egg-server-51business",
"docker": "eggctl start --title=egg-server-51business",
"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",
"autod": "autod"
},
"ci": {
"version": "8"
},
"repository": {
"type": "git",
"url": ""
},
"author": "H",
"license": "MIT"
}
'use strict';
const { app, assert } = require('egg-mock/bootstrap');
describe('test/app/controller/home.test.js', () => {
it('should assert', function* () {
const pkg = require('../../../package.json');
assert(app.config.keys.startsWith(pkg.name));
// const ctx = app.mockContext({});
// yield ctx.service.xx();
});
it('should GET /', () => {
return app.httpRequest()
.get('/')
.expect('hi, egg')
.expect(200);
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment