fix globals

This commit is contained in:
srgooglo 2022-02-18 13:25:43 +01:00
parent 2b6d7eec40
commit 97497dc642
2 changed files with 13 additions and 12 deletions

View File

@ -3,17 +3,18 @@
"version": "0.10.0",
"description": "A simple, fast, and powerful REST API interface library",
"author": "RageStudio",
"main": "dist/index.js",
"main": "./dist/client/index.js",
"scripts": {
"start": "corenode-node ./src/bin/server.js",
"build": "corenode-cli build --parallel --clean --fix && chmod -R 777 ./dist",
"build": "corenode-cli build --parallel --clean && chmod -R 777 ./dist",
"test": "mocha"
},
"publishConfig": {
"access": "public"
},
"files": [
"**/**"
"dist/**/**",
"./package.json"
],
"license": "MIT",
"dependencies": {

View File

@ -1,19 +1,19 @@
const fs = require("fs")
const path = require("path")
const packageJSON = require(path.resolve(process.cwd(), "package.json"))
const fs = require("fs")
const http = require("nanoexpress")
const net = require("corenode/net")
const packageJSON = require(path.resolve(module.path, "../../package.json"))
global.LINEBRIDGE_SERVER_VERSION = packageJSON.version
const tokenizer = require("corenode/libs/tokenizer")
const { randomWord } = require("@corenode/utils")
const { serverManifest } = require("../lib")
const SERVER_VERSION = global.SERVER_VERSION = packageJSON.version
const LOCALHOST_ADDRESS = global.LOCALHOST_ADDRESS = net.ip.getHostAddress() ?? "localhost"
const VALID_HTTP_METHODS = global.VALID_HTTP_METHODS = ["get", "post", "put", "patch", "del", "trace", "head", "any", "options", "ws"]
const DEFAULT_HEADERS = global.DEFAULT_HEADERS = {
global.LOCALHOST_ADDRESS = net.ip.getHostAddress() ?? "localhost"
global.VALID_HTTP_METHODS = ["get", "post", "put", "patch", "del", "trace", "head", "any", "options", "ws"]
global.DEFAULT_HEADERS = {
"Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE, DEL",
@ -191,11 +191,11 @@ class Server {
route: "/",
fn: (req, res) => {
return res.json({
LINEBRIDGE_SERVER_VERSION: LINEBRIDGE_SERVER_VERSION,
id: this.id,
usid: this.usid,
oskid: this.oskid,
time: new Date().getTime(),
version: SERVER_VERSION,
requestTime: new Date().getTime(),
endpointsMap: this.endpointsMap,
})
}