mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 18:44:17 +00:00
require form corenode dist
This commit is contained in:
parent
2e05db6986
commit
14a97f580a
@ -1,6 +1,5 @@
|
|||||||
const axios = require("axios")
|
const axios = require("axios")
|
||||||
const { camalize } = require("@corenode/utils")
|
const { camalize } = require("@corenode/utils")
|
||||||
|
|
||||||
class Bridge {
|
class Bridge {
|
||||||
constructor(params) {
|
constructor(params) {
|
||||||
this.params = params
|
this.params = params
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//* LIBRARIES
|
//* LIBRARIES
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const { websocket } = require('corenode').net
|
const { websocket } = require('corenode/dist/net')
|
||||||
|
|
||||||
//* constables
|
//* constables
|
||||||
const NETHUB_HOSTNAME = IS_DEV ? "localhost" : global.NETHUB_HOSTNAME = "nethub.ragestudio.net"
|
const NETHUB_HOSTNAME = IS_DEV ? "localhost" : global.NETHUB_HOSTNAME = "nethub.ragestudio.net"
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
const express = require("express")
|
const express = require("express")
|
||||||
const { net } = require("corenode")
|
|
||||||
|
|
||||||
const { objectToArrayMap } = require("@corenode/utils")
|
const { objectToArrayMap } = require("@corenode/utils")
|
||||||
|
const { nanoid } = require("nanoid")
|
||||||
const tokenizer = require("corenode/dist/libs/tokenizer")
|
const tokenizer = require("corenode/dist/libs/tokenizer")
|
||||||
|
const net = require("corenode/dist/net")
|
||||||
|
|
||||||
const classes = require("../classes")
|
const classes = require("../classes")
|
||||||
const nethub = require("../lib/nethub")
|
const nethub = require("../lib/nethub")
|
||||||
@ -62,7 +63,6 @@ class Server {
|
|||||||
this._everyRequest = null
|
this._everyRequest = null
|
||||||
this._onRequest = {}
|
this._onRequest = {}
|
||||||
|
|
||||||
|
|
||||||
this.localOrigin = `http://${hostAddress}:${this.port}`
|
this.localOrigin = `http://${hostAddress}:${this.port}`
|
||||||
this.nethubOrigin = ""
|
this.nethubOrigin = ""
|
||||||
|
|
||||||
@ -105,9 +105,11 @@ class Server {
|
|||||||
|
|
||||||
handleRequest = (req, res, next, endpoint) => {
|
handleRequest = (req, res, next, endpoint) => {
|
||||||
const { route, method, controller } = endpoint
|
const { route, method, controller } = endpoint
|
||||||
|
req.requestId = nanoid()
|
||||||
|
|
||||||
// exec controller
|
// exec controller
|
||||||
if (typeof controller.exec === "function") {
|
if (typeof controller.exec === "function") {
|
||||||
|
res.setHeader("request_id", req.requestId)
|
||||||
controller.exec(req, res, next)
|
controller.exec(req, res, next)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,6 +167,11 @@ class Server {
|
|||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.httpServer.use((req, res, next) => {
|
||||||
|
res.removeHeader("X-Powered-By")
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
|
||||||
// set endpoints
|
// set endpoints
|
||||||
if (Array.isArray(this.params.endpoints)) {
|
if (Array.isArray(this.params.endpoints)) {
|
||||||
this.params.endpoints.forEach((endpoint) => {
|
this.params.endpoints.forEach((endpoint) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user