1.7.0 • Published 12 months ago
@galenjs/framework v1.7.0
framework
galenjs framework base on Koa.
Usage
const Framework = require('@galenjs/framework')
const koaBody = require('koa-body')
const koaLogger = require('koa-logger')
const bodyParser = require('koa-bodyparser')
const middlewares = [koaLogger(), koaBody({}), bodyParser()]
const bootstrap = async () => {
const framework = new Framework(config)
await framework.init()
freamework.app.use(...middlewares)
await framework.start()
}
bootstrap()
配置
port
配置项目开放的端口
workspace
项目路径
plugins
插件系统
例如:
plugins: ['doc']
modelPath
模型相对项目路径
例如:
modelPath: 'app/models'
controllerPath
控制器相对项目路径
例如:
controllerPath: 'app/controller'
servicePath
公用方法相对项目路径
例如:
servicePath: 'app/service'
middlewarePath
中间件相对项目路径
例如:
middlewarePath: 'app/middleware'
sequelize
sequelize数据模型配置,支持多实例配置
例如:
sequelize: {
default: {
host: '127.0.0.1',
user: 'root',
password: 'alfieri',
database: 'test'
},
clients: {
main: {}
}
}
redis
redis配置,支持多实例配置
例如:
redis: {
default: {
host: '127.0.0.1',
port: 6379,
password: '',
db: 2
},
clients: {
main: {
keyPrefix: 'main'
}
}
}
influx
influx数据模型配置
例如:
influx: {
host: '127.0.0.1',
database: 'test'
}
配置示例
module.exports = {
port: 4000,
plugin: {
mainPath: 'plugins',
plugins: ['doc']
},
workspace: process.cwd(),
modelPath: 'app/models',
controllerPath: 'app/controller',
servicePath: 'app/service',
sequelize: {
default: {
host: '127.0.0.1',
user: 'root',
password: 'alfieri',
database: 'test'
},
clients: {
main: {}
}
},
influx: {
host: '127.0.0.1',
database: 'test'
},
redis: {
default: {
host: '127.0.0.1',
port: 6379,
password: '',
db: 2
},
clients: {
main: {
keyPrefix: 'main'
}
}
}
}
1.7.0
12 months ago
1.3.6
3 years ago
1.3.5
3 years ago
1.3.4
3 years ago
1.4.1
3 years ago
1.4.0
3 years ago
1.2.0
3 years ago
1.2.1
3 years ago
1.1.11-alpha.0
3 years ago
1.0.17
3 years ago
1.0.0
4 years ago
0.7.27
4 years ago
0.7.20
4 years ago
0.7.14
4 years ago
0.7.8
4 years ago
0.7.1
4 years ago
0.7.0
4 years ago
0.6.14
4 years ago
0.6.10
4 years ago
0.6.12
4 years ago
0.6.11
4 years ago
0.6.13
4 years ago
0.6.7
4 years ago
0.6.9
4 years ago
0.6.8
4 years ago
0.6.6
4 years ago
0.6.5
4 years ago
0.6.4
4 years ago
0.6.3
4 years ago
0.6.2
4 years ago
0.6.1
4 years ago
0.6.0
4 years ago
0.5.16
4 years ago