v0.0.4
This commit is contained in:
parent
496aab75e9
commit
54088e3f10
@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
parserOptions: {
|
||||
ecmaVersion: 6, //指定ECMAScript支持的版本,6为ES6
|
||||
ecmaVersion: 8, //指定ECMAScript支持的版本,6为ES6,这里为了兼容async和await,设置为8
|
||||
sourceType: 'module'
|
||||
},
|
||||
extends: 'standard',
|
||||
@ -12,7 +12,7 @@ module.exports = {
|
||||
env: {
|
||||
'node': true
|
||||
},
|
||||
rules: { // add your custom rules here
|
||||
rules: {
|
||||
// allow console
|
||||
'no-console': 0,
|
||||
// allow paren-less arrow functions
|
||||
|
@ -470,3 +470,10 @@ request.post('/api').form({key:'value'}), function(err,httpResponse,body){ /* ..
|
||||
```
|
||||
|
||||
删除gulpfile.js中的lint、eslint_start两个任务,并且把default改为“gulp.task('default', ['start']”。
|
||||
|
||||
## 更新说明
|
||||
|
||||
*v0.0.4 2017年02月07日15:57:17*
|
||||
1、修改了部分配置文件的配置方法,使之更为规范(老版本用户无须理会,对程序没有影响)。
|
||||
2、修改了eslintrc.js文件中的JavaScript版本配置,改为ES8,兼容async、await。
|
||||
3、修改gulpfile.js文件第12行,检查`src/**/*.js`文件。
|
||||
|
@ -9,8 +9,8 @@ if (process.env.npm_config_argv.indexOf('debug') > 0) {
|
||||
}
|
||||
|
||||
gulp.task('lint', () => {
|
||||
return gulp.src(['src/*.js', '!node_modules/**'])
|
||||
.pipe(eslint({configFile: '.eslintrc.js'}))
|
||||
return gulp.src(['src/**/*.js', '!node_modules/**'])
|
||||
.pipe(eslint({configFile: './.eslintrc.js'}))
|
||||
.pipe(eslint.format(friendlyFormatter))
|
||||
// .pipe(eslint.failAfterError())
|
||||
.pipe(eslint.results(results => {
|
||||
|
@ -3,7 +3,7 @@ import KoaBody from 'koa-body'
|
||||
import KoaSession from 'koa-session2'
|
||||
import KoaStatic from 'koa-static2'
|
||||
import {
|
||||
SystemConfig
|
||||
System as SystemConfig
|
||||
} from './config'
|
||||
import path from 'path'
|
||||
import MainRoutes from './routes/main-routes'
|
||||
|
@ -1,18 +1,23 @@
|
||||
import path from 'path'
|
||||
|
||||
export let SystemConfig = {
|
||||
// 系统配置
|
||||
export let System = {
|
||||
HTTP_server_type: 'http://', // HTTP服务器地址,包含"http://"或"https://"
|
||||
HTTP_server_host: 'localhost', // HTTP服务器地址,请勿添加"http://"
|
||||
HTTP_server_port: '3000', // HTTP服务器端口号
|
||||
System_country: 'zh-cn', // 所在国家的国家代码
|
||||
System_plugin_path: path.join(__dirname, './plugins'), // 插件路径
|
||||
Session_Key: 'RESTfulAPI', // 生产环境务必随机设置一个值
|
||||
mysql_host: 'localhost', // MySQL服务器地址
|
||||
mysql_user: 'root', // 数据库用户名
|
||||
mysql_password: 'root', // 数据库密码
|
||||
mysql_database: 'test', // 数据库名称
|
||||
mysql_port: 3306, // 数据库端口号
|
||||
mysql_prefix: 'api_' // 默认"api_"
|
||||
db_type: 'mysql' // 数据库类型
|
||||
}
|
||||
|
||||
export let DB = {
|
||||
host: 'localhost', // 服务器地址
|
||||
port: 3306, // 数据库端口号
|
||||
username: 'admin', // 数据库用户名
|
||||
password: 'admin888', // 数据库密码
|
||||
database: 'development', // 数据库名称
|
||||
prefix: 'api_' // 默认"api_"
|
||||
}
|
||||
|
||||
export let SendEmail = {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import Sequelize from 'sequelize'
|
||||
import { SystemConfig } from '../config'
|
||||
import { DB as DBConfig, System as SystemConfig } from '../config'
|
||||
|
||||
export default new Sequelize(SystemConfig.mysql_database, SystemConfig.mysql_user, SystemConfig.mysql_password, {
|
||||
host: SystemConfig.mysql_host,
|
||||
dialect: 'mysql',
|
||||
export default new Sequelize(DBConfig.database, DBConfig.username, DBConfig.password, {
|
||||
host: DBConfig.host,
|
||||
dialect: SystemConfig.db_type,
|
||||
pool: {
|
||||
max: 50,
|
||||
min: 0,
|
||||
|
Loading…
Reference in New Issue
Block a user