mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 18:44: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 fs = require("fs")
|
||||||
const net = require("corenode/net")
|
const net = require("corenode/net")
|
||||||
|
|
||||||
const http = require("nanoexpress")
|
const HyperExpress = require("hyper-express")
|
||||||
const io = require("socket.io")
|
const io = require("socket.io")
|
||||||
|
|
||||||
const packageJSON = require(path.resolve(module.path, "../../package.json"))
|
const packageJSON = require(path.resolve(module.path, "../../package.json"))
|
||||||
@ -26,7 +26,6 @@ global.DEFAULT_HEADERS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultMiddlewares = [
|
const defaultMiddlewares = [
|
||||||
require("@nanoexpress/middleware-body-parser/cjs")(),
|
|
||||||
require('cors')({
|
require('cors')({
|
||||||
"origin": "*",
|
"origin": "*",
|
||||||
"methods": DEFAULT_HEADERS["Access-Control-Allow-Methods"],
|
"methods": DEFAULT_HEADERS["Access-Control-Allow-Methods"],
|
||||||
@ -59,7 +58,7 @@ class Server {
|
|||||||
this.WSAddress = `ws://${LOCALHOST_ADDRESS}:${this.WSListenPort}`
|
this.WSAddress = `ws://${LOCALHOST_ADDRESS}:${this.WSListenPort}`
|
||||||
|
|
||||||
//* set server basics
|
//* set server basics
|
||||||
this.httpInterface = global.httpInterface = http()
|
this.httpInterface = global.httpInterface = new HyperExpress.Server()
|
||||||
this.wsInterface = global.wsInterface = {
|
this.wsInterface = global.wsInterface = {
|
||||||
io: new io.Server(this.WSListenPort),
|
io: new io.Server(this.WSListenPort),
|
||||||
map: {},
|
map: {},
|
||||||
@ -120,7 +119,7 @@ class Server {
|
|||||||
// initialize http server
|
// initialize http server
|
||||||
await this.httpInterface.listen(this.HTTPlistenPort, this.params.listen ?? "0.0.0.0")
|
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) => {
|
handleWSClientConnection = async (socket) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user