mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
use nanoexpress lib
This commit is contained in:
parent
32f8a657f2
commit
c81094f5f0
@ -19,16 +19,18 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"socket.io": "^4.2.0",
|
||||
"@corenode/helpers": "^0.28.18",
|
||||
"@corenode/utils": "^0.28.18",
|
||||
"corenode": "^0.28.18",
|
||||
"axios": "^0.22.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"corenode": "^0.28.18",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.1",
|
||||
"md5": "^2.3.0",
|
||||
"morgan": "^1.10.0",
|
||||
"nanoexpress": "^5.1.2",
|
||||
"nanoid": "^3.1.28",
|
||||
"socket.io": "^4.2.0",
|
||||
"uuid": "^8.3.2",
|
||||
"websocket": "^1.0.34"
|
||||
},
|
||||
|
@ -1,5 +1,6 @@
|
||||
const fs = require("fs")
|
||||
const express = require("express")
|
||||
const http = require("nanoexpress")
|
||||
const bodyParser = require('body-parser')
|
||||
|
||||
const { nanoid } = require("nanoid")
|
||||
const tokenizer = require("corenode/libs/tokenizer")
|
||||
@ -47,8 +48,7 @@ class Server {
|
||||
this.headers = { ...defaultHeaders, ...this.params.headers }
|
||||
|
||||
//* set server basics
|
||||
this.httpServer = require("express")()
|
||||
this.router = express.Router()
|
||||
this.httpServer = http()
|
||||
|
||||
//* set id's
|
||||
this.id = this.params.id ?? process.runtime?.helpers?.getRootPackage()?.name ?? "unavailable"
|
||||
@ -178,13 +178,13 @@ class Server {
|
||||
}
|
||||
|
||||
// append to router
|
||||
this.router[controller.method](...routeModel)
|
||||
this.httpServer[controller.method](...routeModel)
|
||||
}
|
||||
|
||||
preInitialization() {
|
||||
// set middlewares
|
||||
this.httpServer.use(express.json())
|
||||
this.httpServer.use(express.urlencoded({ extended: true }))
|
||||
this.httpServer.use(bodyParser.json())
|
||||
this.httpServer.use(bodyParser.urlencoded({ extended: true }))
|
||||
|
||||
if (Array.isArray(this.serverMiddlewares)) {
|
||||
this.serverMiddlewares.forEach((middleware) => {
|
||||
@ -268,8 +268,6 @@ class Server {
|
||||
})
|
||||
}
|
||||
|
||||
this.httpServer.use('/', this.router)
|
||||
|
||||
this.httpServer.listen(this.port, this.params.listen ?? '0.0.0.0', () => {
|
||||
//? register to nethub
|
||||
if (this.params.onlineNethub) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user