From 67a63bf67ee256dd5aa4a780d64b32b9475e2a19 Mon Sep 17 00:00:00 2001 From: yutent Date: Thu, 2 Nov 2023 10:54:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=A4=9A=E4=BD=99=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/index.js | 7 ------- index.js | 25 +------------------------ package.json | 13 +++++++++++-- 3 files changed, 12 insertions(+), 33 deletions(-) diff --git a/config/index.js b/config/index.js index 6d61215..f5b9dfd 100644 --- a/config/index.js +++ b/config/index.js @@ -13,13 +13,6 @@ export default { port: 3000, env: process.env.NODE_ENV === ENV_PROD ? ENV_PROD : ENV_DEV, debug: process.env.NODE_ENV === ENV_DEV, // debug模式 - smtp: { - host: 'smtp.example.com', - port: 25, - mail: 'no-reply@example.com', - name: 'no-reply', - passwd: '' - }, cors: { enabled: false, diff --git a/index.js b/index.js index 488e621..f83e550 100644 --- a/index.js +++ b/index.js @@ -12,13 +12,11 @@ import fs from 'iofs' import Request from '@gm5/request' import Response from '@gm5/response' -// import { sessionPackage, sessionConnect } from '@gm5/session' -// import { jwtPackage, jwtConnect } from '@gm5/jwt' import { noop, readonlyProp } from './lib.js' import config from './config/index.js' -import { createRouter } from './middleware/router.js' import { createCors } from './middleware/cors.js' +import { createRouter } from './middleware/router.js' process.on('uncaughtException', err => { console.error('UncaughtException: ', err) @@ -35,26 +33,6 @@ class Five { readonlyProp(this, 'state', Object.create(null)) } - #loadBuildIn() { - // let { domain, website, session, jwt } = this.#config - // domain = domain || website - // session.domain = session.domain || domain - // this.set({ domain, session }) - // 将jwt & session中间件提到最前 - // 以便用户自定义的中间件可以直接操作session - // if (session.enabled) { - // this.install(sessionPackage) - // this.#middlewares.unshift(sessionConnect) - // } - // // 开启jwt - // if (jwt) { - // this.install(jwtPackage) - // this.#middlewares.unshift(jwtConnect) - // } - // 路由中间件要在最后 - // this.use(createRouter()) - } - async #loop(req, res, idx = 0) { let fn = this.#middlewares[idx] if (fn) { @@ -158,7 +136,6 @@ class Five { run() { this.#server = http.createServer() - // this.#loadBuildIn() // 路由中间件要在最后 this.use(createRouter()) diff --git a/package.json b/package.json index 3b48145..233774a 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "@gm5/response": "^2.0.1", "@gm5/controller": "^2.0.2", "@gm5/jwt": "^2.0.2", - "@gm5/views": "^1.0.0", + "@gm5/views": "^2.0.0", "crypto.js": "^3.1.2", "es.shim": "^2.2.0", "iofs": "^1.5.3" @@ -22,7 +22,16 @@ "url": "https://git.wkit.fun/gm5/core.git" }, "keywords": [ - "five, fivejs, node-five, five.js, nodejs, mvc, koa, express" + "five", + "fivejs", + "node-five", + "five.js", + "gm5", + "gmf", + "nodejs", + "mvc", + "koa", + "express" ], "engines": { "node": ">=16.0.0"