update
parent
e3ab578088
commit
566432e529
|
@ -19,11 +19,7 @@ export default {
|
|||
db: 0
|
||||
}
|
||||
},
|
||||
jwt: {
|
||||
ttl: 3600 * 24 * 7,
|
||||
level: 0, // 校验级别, 0: 不校验客户端, 2: ua, 4: ip, 6: ua + ip
|
||||
secret: 'it_is_secret_key' // jwt密钥, 使用时请修改
|
||||
},
|
||||
|
||||
spa: false, // 单路由模式, 即无论是访问路径是什么, 永远只会调用 \apps\index\index()
|
||||
website: 'localhost',
|
||||
domain: '', // cookie域, 默认等于website
|
||||
|
|
14
index.js
14
index.js
|
@ -29,6 +29,8 @@ class Five {
|
|||
#modules = {}
|
||||
#middlewares = [createCors()]
|
||||
|
||||
#server = null
|
||||
|
||||
constructor() {
|
||||
readonlyProp(this, 'state', Object.create(null))
|
||||
}
|
||||
|
@ -65,6 +67,12 @@ class Five {
|
|||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
get server(){
|
||||
return this.#server
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
// 注册属性到全局Five对象
|
||||
set(obj) {
|
||||
for (let i in obj) {
|
||||
|
@ -148,15 +156,13 @@ class Five {
|
|||
}
|
||||
|
||||
run() {
|
||||
let server = http.createServer()
|
||||
|
||||
this.server = server
|
||||
this.#server = http.createServer()
|
||||
|
||||
// this.#loadBuildIn()
|
||||
// 路由中间件要在最后
|
||||
this.use(createRouter())
|
||||
|
||||
server
|
||||
this.#server
|
||||
.on('request', (req, res) => {
|
||||
let request = new Request(req, res)
|
||||
let response = new Response(req, res)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"devDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/bytedo/gmf.core.git"
|
||||
"url": "https://git.wkit.fun/gm5/core.git"
|
||||
},
|
||||
"keywords": [
|
||||
"five, fivejs, node-five, five.js, nodejs, mvc, koa, express"
|
||||
|
|
Loading…
Reference in New Issue