移除多余代码

v2
yutent 2023-11-02 10:54:37 +08:00
parent 98c1033392
commit 67a63bf67e
3 changed files with 12 additions and 33 deletions

View File

@ -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,

View File

@ -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())

View File

@ -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"