1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-07 19:32:34 +01:00

start.ts file

This commit is contained in:
Flam3rboy 2021-05-31 20:41:44 +02:00
parent 3f4df736d0
commit f0d59bb37d
4 changed files with 27 additions and 26 deletions

14
package-lock.json generated
View File

@ -19,7 +19,7 @@
"file-type": "^16.5.0",
"image-size": "^1.0.0",
"lambert-db": "^1.2.3",
"lambert-server": "^1.2.1",
"lambert-server": "^1.2.4",
"missing-native-js-functions": "^1.0.8",
"multer": "^1.4.2",
"node-fetch": "^2.6.1",
@ -995,9 +995,9 @@
}
},
"node_modules/lambert-server": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/lambert-server/-/lambert-server-1.2.1.tgz",
"integrity": "sha512-ApyFBSOLlhCcTOePIILgtBz5m3+4AGaQEiS9T35etwKcZt9yjHQmMUOXD49ELxV9RQk620LB2APIlB9MexeprQ==",
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/lambert-server/-/lambert-server-1.2.4.tgz",
"integrity": "sha512-7dDX4ZtK5Z8bDVoKIN7y/7h+4g3bW5UUTbPMViJGOiMhE39b8MytPByTZsEE+Re/SZaGmEEwBheE9HG0Qjd5yQ==",
"dependencies": {
"body-parser": "^1.19.0",
"express": "^4.17.1",
@ -2522,9 +2522,9 @@
}
},
"lambert-server": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/lambert-server/-/lambert-server-1.2.1.tgz",
"integrity": "sha512-ApyFBSOLlhCcTOePIILgtBz5m3+4AGaQEiS9T35etwKcZt9yjHQmMUOXD49ELxV9RQk620LB2APIlB9MexeprQ==",
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/lambert-server/-/lambert-server-1.2.4.tgz",
"integrity": "sha512-7dDX4ZtK5Z8bDVoKIN7y/7h+4g3bW5UUTbPMViJGOiMhE39b8MytPByTZsEE+Re/SZaGmEEwBheE9HG0Qjd5yQ==",
"requires": {
"body-parser": "^1.19.0",
"express": "^4.17.1",

View File

@ -6,7 +6,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc -b .",
"start": "npm run build && node dist/"
"start": "npm run build && node dist/start.js"
},
"repository": {
"type": "git",
@ -30,7 +30,7 @@
"file-type": "^16.5.0",
"image-size": "^1.0.0",
"lambert-db": "^1.2.3",
"lambert-server": "^1.2.1",
"lambert-server": "^1.2.4",
"missing-native-js-functions": "^1.0.8",
"multer": "^1.4.2",
"node-fetch": "^2.6.1",

View File

@ -1,17 +1 @@
import { CDNServer } from "./Server";
import dotenv from "dotenv";
dotenv.config();
if (process.env.STORAGE_LOCATION) {
if (!process.env.STORAGE_LOCATION.startsWith("/")) {
process.env.STORAGE_LOCATION = __dirname + "/../" + process.env.STORAGE_LOCATION;
}
} else process.env.STORAGE_LOCATION = __dirname + "/../files/";
const server = new CDNServer({ port: Number(process.env.PORT) || 3003 });
server
.start()
.then(() => {
console.log("[Server] started on :" + server.options.port);
})
.catch((e) => console.error("[Server] Error starting: ", e));
export * from "./Server";

17
src/start.ts Normal file
View File

@ -0,0 +1,17 @@
import { CDNServer } from "./Server";
import dotenv from "dotenv";
dotenv.config();
if (process.env.STORAGE_LOCATION) {
if (!process.env.STORAGE_LOCATION.startsWith("/")) {
process.env.STORAGE_LOCATION = __dirname + "/../" + process.env.STORAGE_LOCATION;
}
} else process.env.STORAGE_LOCATION = __dirname + "/../files/";
const server = new CDNServer({ port: Number(process.env.PORT) || 3003 });
server
.start()
.then(() => {
console.log("[Server] started on :" + server.options.port);
})
.catch((e) => console.error("[Server] Error starting: ", e));