mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
use Hyper-Express lib
This commit is contained in:
parent
d4002163af
commit
a68cdb1ffe
@ -2,7 +2,7 @@ const path = require("path")
|
||||
const fs = require("fs")
|
||||
const net = require("corenode/net")
|
||||
|
||||
const http = require("nanoexpress")
|
||||
const HyperExpress = require("hyper-express")
|
||||
const io = require("socket.io")
|
||||
|
||||
const packageJSON = require(path.resolve(module.path, "../../package.json"))
|
||||
@ -26,7 +26,6 @@ global.DEFAULT_HEADERS = {
|
||||
}
|
||||
|
||||
const defaultMiddlewares = [
|
||||
require("@nanoexpress/middleware-body-parser/cjs")(),
|
||||
require('cors')({
|
||||
"origin": "*",
|
||||
"methods": DEFAULT_HEADERS["Access-Control-Allow-Methods"],
|
||||
@ -59,7 +58,7 @@ class Server {
|
||||
this.WSAddress = `ws://${LOCALHOST_ADDRESS}:${this.WSListenPort}`
|
||||
|
||||
//* set server basics
|
||||
this.httpInterface = global.httpInterface = http()
|
||||
this.httpInterface = global.httpInterface = new HyperExpress.Server()
|
||||
this.wsInterface = global.wsInterface = {
|
||||
io: new io.Server(this.WSListenPort),
|
||||
map: {},
|
||||
@ -120,7 +119,7 @@ class Server {
|
||||
// initialize http server
|
||||
await this.httpInterface.listen(this.HTTPlistenPort, this.params.listen ?? "0.0.0.0")
|
||||
|
||||
console.log(`✅ Ready on port ${this.HTTPlistenPort}!`)
|
||||
console.log(`✅ Server is up and running!`)
|
||||
}
|
||||
|
||||
handleWSClientConnection = async (socket) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user