✨ start.ts file
This commit is contained in:
parent
3f4df736d0
commit
f0d59bb37d
BIN
package-lock.json
generated
BIN
package-lock.json
generated
Binary file not shown.
@ -6,7 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"build": "tsc -b .",
|
"build": "tsc -b .",
|
||||||
"start": "npm run build && node dist/"
|
"start": "npm run build && node dist/start.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -30,7 +30,7 @@
|
|||||||
"file-type": "^16.5.0",
|
"file-type": "^16.5.0",
|
||||||
"image-size": "^1.0.0",
|
"image-size": "^1.0.0",
|
||||||
"lambert-db": "^1.2.3",
|
"lambert-db": "^1.2.3",
|
||||||
"lambert-server": "^1.2.1",
|
"lambert-server": "^1.2.4",
|
||||||
"missing-native-js-functions": "^1.0.8",
|
"missing-native-js-functions": "^1.0.8",
|
||||||
"multer": "^1.4.2",
|
"multer": "^1.4.2",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
|
|||||||
18
src/index.ts
18
src/index.ts
@ -1,17 +1 @@
|
|||||||
import { CDNServer } from "./Server";
|
export * 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));
|
|
||||||
|
|||||||
17
src/start.ts
Normal file
17
src/start.ts
Normal 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));
|
||||||
Reference in New Issue
Block a user