v0.0.5 修复bug

This commit is contained in:
2017-01-23 15:39:41 +08:00
parent ef84eb8428
commit 502ff4aa94
7 changed files with 75 additions and 58 deletions

View File

@ -2,7 +2,7 @@ import Koa2 from 'koa'
import KoaBody from 'koa-body'
import KoaSession from 'koa-session2'
import KoaStatic from 'koa-static2'
import { SystemConfig } from '../config/main.js'
import { SystemConfig } from './config'
import path from 'path'
import MainRoutes from './routes/main-routes'
import ErrorRoutes from './routes/error-routes'

23
src/config.js Normal file
View File

@ -0,0 +1,23 @@
import path from 'path'
export let SystemConfig = {
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, "../src/plugins"), // 插件路径
Session_Key: 'RESTfulAPI', // 生产环境务必随机设置一个值
mysql_host: 'localhost', // MySQL服务器地址
mysql_user: 'root', // 数据库用户名
mysql_password: 'root', // 数据库密码
mysql_database: 'test', // 数据库名称
mysql_port: 3306, // 数据库端口号
mysql_prefix: 'api_' // 默认"api_"
}
export let SendEmail = {
service: 'smtp.abcd.com', // SMTP服务提供商域名
username: 'postmaster%40abcd.com', // 用户名/用户邮箱
password: 'password', // 邮箱密码
sender_address: '"XX平台 👥" <postmaster@abcd.com>'
}

View File

@ -1,5 +1,5 @@
import mysql from 'promise-mysql'
import { SystemConfig } from '../config.js'
import { SystemConfig } from '../config'
import { SqlFormat } from '../tool/common_tool.js'
let pool = mysql.createPool({

View File

@ -1,5 +1,5 @@
import Sequelize from 'sequelize'
import { SystemConfig } from '../config/main'
import { SystemConfig } from '../config'
export default new Sequelize(SystemConfig.mysql_database, SystemConfig.mysql_user, SystemConfig.mysql_password, {
host: SystemConfig.mysql_host,

View File

@ -1,5 +1,5 @@
import nodemailer from 'nodemailer'
import { SendEmail } from '../../../config/main'
import { SendEmail } from '../../config'
// 发送Email目前使用的是阿里云SMTP发送邮件
// receivers 目标邮箱,可以用英文逗号分隔多个。(我没试过)

View File

@ -1,6 +1,6 @@
import {
SystemConfig
} from '../config/main.js'
} from '../config'
// 截取字符串,多余的部分用...代替
export let setString = (str, len) => {