This commit is contained in:
yi-ge 2017-01-28 19:47:09 +08:00
parent 40bddcfcdd
commit d72827d08e
5 changed files with 8 additions and 5 deletions

View File

@ -12,7 +12,7 @@
"dependencies": {
"koa": "^2.0.0",
"koa-body": "^2.0.0",
"koa-compose": "^2.5.1",
"koa-compose": "^3.2.1",
"koa-router": "^7.0.1",
"koa-session2": "^1.0.8",
"koa-static2": "^0.1.8",

View File

@ -8,7 +8,7 @@ import {
import path from 'path'
import MainRoutes from './routes/main-routes'
import ErrorRoutes from './routes/error-routes'
// import PluginLoader from './tool/PluginLoader'
import PluginLoader from './lib/PluginLoader'
const app = new Koa2()
const env = process.env.NODE_ENV || 'development' // Current mode
@ -25,7 +25,7 @@ app
.use(KoaSession({
key: SystemConfig.Session_Key
})) // Set Session
// .use(PluginLoader(SystemConfig.System_plugin_path))
.use(PluginLoader(SystemConfig.System_plugin_path))
.use((ctx, next) => {
if (ctx.request.header.host.split(':')[0] === 'api.XXX.com' || ctx.request.header.host.split(':')[0] === '127.0.0.1') {
ctx.set('Access-Control-Allow-Origin', '*')

View File

@ -5,7 +5,7 @@ export let SystemConfig = {
HTTP_server_host: 'localhost', // HTTP服务器地址,请勿添加"http://"
HTTP_server_port: '3000', // HTTP服务器端口号
System_country: 'zh-cn', // 所在国家的国家代码
System_plugin_path: path.join(__dirname, '../src/plugins'), // 插件路径
System_plugin_path: path.join(__dirname, './plugins'), // 插件路径
Session_Key: 'RESTfulAPI', // 生产环境务必随机设置一个值
mysql_host: 'localhost', // MySQL服务器地址
mysql_user: 'root', // 数据库用户名

View File

@ -10,7 +10,6 @@ function getDirs (srcpath) {
module.exports = (srcpath, filename = 'index.js') => {
let plugins = {}
let dirs = getDirs(srcpath)
let list = []

View File

@ -1,6 +1,10 @@
import nodemailer from 'nodemailer'
import { SendEmail } from '../../config'
export default () => {
console.log('ok')
}
// 发送Email目前使用的是阿里云SMTP发送邮件
// receivers 目标邮箱,可以用英文逗号分隔多个。(我没试过)
// subject 邮件标题