diff --git a/config/index.js b/config/index.js index a73973c..e71db10 100644 --- a/config/index.js +++ b/config/index.js @@ -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 diff --git a/index.js b/index.js index c6ec0e2..bae1f43 100644 --- a/index.js +++ b/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) diff --git a/package.json b/package.json index a9d4738..ca9aae3 100644 --- a/package.json +++ b/package.json @@ -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"