移除多余代码
parent
98c1033392
commit
67a63bf67e
|
@ -13,13 +13,6 @@ export default {
|
||||||
port: 3000,
|
port: 3000,
|
||||||
env: process.env.NODE_ENV === ENV_PROD ? ENV_PROD : ENV_DEV,
|
env: process.env.NODE_ENV === ENV_PROD ? ENV_PROD : ENV_DEV,
|
||||||
debug: process.env.NODE_ENV === ENV_DEV, // debug模式
|
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: {
|
cors: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
|
25
index.js
25
index.js
|
@ -12,13 +12,11 @@ import fs from 'iofs'
|
||||||
import Request from '@gm5/request'
|
import Request from '@gm5/request'
|
||||||
import Response from '@gm5/response'
|
import Response from '@gm5/response'
|
||||||
|
|
||||||
// import { sessionPackage, sessionConnect } from '@gm5/session'
|
|
||||||
// import { jwtPackage, jwtConnect } from '@gm5/jwt'
|
|
||||||
import { noop, readonlyProp } from './lib.js'
|
import { noop, readonlyProp } from './lib.js'
|
||||||
import config from './config/index.js'
|
import config from './config/index.js'
|
||||||
|
|
||||||
import { createRouter } from './middleware/router.js'
|
|
||||||
import { createCors } from './middleware/cors.js'
|
import { createCors } from './middleware/cors.js'
|
||||||
|
import { createRouter } from './middleware/router.js'
|
||||||
|
|
||||||
process.on('uncaughtException', err => {
|
process.on('uncaughtException', err => {
|
||||||
console.error('UncaughtException: ', err)
|
console.error('UncaughtException: ', err)
|
||||||
|
@ -35,26 +33,6 @@ class Five {
|
||||||
readonlyProp(this, 'state', Object.create(null))
|
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) {
|
async #loop(req, res, idx = 0) {
|
||||||
let fn = this.#middlewares[idx]
|
let fn = this.#middlewares[idx]
|
||||||
if (fn) {
|
if (fn) {
|
||||||
|
@ -158,7 +136,6 @@ class Five {
|
||||||
run() {
|
run() {
|
||||||
this.#server = http.createServer()
|
this.#server = http.createServer()
|
||||||
|
|
||||||
// this.#loadBuildIn()
|
|
||||||
// 路由中间件要在最后
|
// 路由中间件要在最后
|
||||||
this.use(createRouter())
|
this.use(createRouter())
|
||||||
|
|
||||||
|
|
13
package.json
13
package.json
|
@ -11,7 +11,7 @@
|
||||||
"@gm5/response": "^2.0.1",
|
"@gm5/response": "^2.0.1",
|
||||||
"@gm5/controller": "^2.0.2",
|
"@gm5/controller": "^2.0.2",
|
||||||
"@gm5/jwt": "^2.0.2",
|
"@gm5/jwt": "^2.0.2",
|
||||||
"@gm5/views": "^1.0.0",
|
"@gm5/views": "^2.0.0",
|
||||||
"crypto.js": "^3.1.2",
|
"crypto.js": "^3.1.2",
|
||||||
"es.shim": "^2.2.0",
|
"es.shim": "^2.2.0",
|
||||||
"iofs": "^1.5.3"
|
"iofs": "^1.5.3"
|
||||||
|
@ -22,7 +22,16 @@
|
||||||
"url": "https://git.wkit.fun/gm5/core.git"
|
"url": "https://git.wkit.fun/gm5/core.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"five, fivejs, node-five, five.js, nodejs, mvc, koa, express"
|
"five",
|
||||||
|
"fivejs",
|
||||||
|
"node-five",
|
||||||
|
"five.js",
|
||||||
|
"gm5",
|
||||||
|
"gmf",
|
||||||
|
"nodejs",
|
||||||
|
"mvc",
|
||||||
|
"koa",
|
||||||
|
"express"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.0.0"
|
"node": ">=16.0.0"
|
||||||
|
|
Loading…
Reference in New Issue