✨ server bundle
This commit is contained in:
parent
96080e8786
commit
bacb78f5c5
BIN
bundle/package-lock.json
generated
BIN
bundle/package-lock.json
generated
Binary file not shown.
@ -11,6 +11,7 @@
|
||||
"build:cdn": "cd ../cdn/ && npm run build",
|
||||
"build:gateway": "cd ../gateway/ && npm run build",
|
||||
"start": "npm run build && node dist/start.js",
|
||||
"root": "npm run build && node dist/root.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
@ -25,19 +26,19 @@
|
||||
},
|
||||
"homepage": "https://fosscord.com",
|
||||
"dependencies": {
|
||||
"@types/async-exit-hook": "^2.0.0",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/node-os-utils": "^1.2.0",
|
||||
"typescript": "^4.3.5",
|
||||
"@types/node": "^16.6.1",
|
||||
"@fosscord/api": "file:../api",
|
||||
"@fosscord/cdn": "file:../cdn",
|
||||
"@fosscord/gateway": "file:../gateway",
|
||||
"@fosscord/util": "file:../util",
|
||||
"@types/async-exit-hook": "^2.0.0",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/node": "^16.6.1",
|
||||
"@types/node-os-utils": "^1.2.0",
|
||||
"async-exit-hook": "^2.0.1",
|
||||
"express": "^4.17.1",
|
||||
"link": "^0.1.5",
|
||||
"mongodb-memory-server-global-4.4": "^7.3.6",
|
||||
"node-os-utils": "^1.3.5"
|
||||
"node-os-utils": "^1.3.5",
|
||||
"typescript": "^4.3.5"
|
||||
}
|
||||
}
|
||||
|
||||
33
bundle/src/root.ts
Normal file
33
bundle/src/root.ts
Normal file
@ -0,0 +1,33 @@
|
||||
process.on("unhandledRejection", console.error);
|
||||
process.on("uncaughtException", console.error);
|
||||
|
||||
import { FosscordServer as APIServer } from "@fosscord/api";
|
||||
import { Server as GatewayServer } from "@fosscord/gateway";
|
||||
import { CDNServer } from "@fosscord/cdn/";
|
||||
import { Config } from "../../util/dist";
|
||||
|
||||
const production = true;
|
||||
|
||||
const api = new APIServer({ production, port: Number(process.env.API_PORT) || 3001 });
|
||||
const gateway = new GatewayServer({ port: Number(process.env.GATEWAY_PORT) || 3002 });
|
||||
const cdn = new CDNServer({ production, port: Number(process.env.CDN_PORT) || 3003 });
|
||||
|
||||
async function main() {
|
||||
await Config.set({
|
||||
cdn: {
|
||||
endpointClient: "${location.host}",
|
||||
endpoint: `http://localhost:${cdn.options.port}`,
|
||||
},
|
||||
gateway: {
|
||||
endpointClient:
|
||||
'${location.protocol === "https:" ? "wss://" : "ws://"}${location.hostname}:' + gateway.port,
|
||||
endpoint: `ws://localhost:${gateway.port}`,
|
||||
},
|
||||
});
|
||||
|
||||
await api.start();
|
||||
await cdn.start();
|
||||
await gateway.start();
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
BIN
gateway/package-lock.json
generated
BIN
gateway/package-lock.json
generated
Binary file not shown.
@ -32,7 +32,6 @@
|
||||
"@types/mongoose-autopopulate": "^0.10.1",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"@types/ws": "^7.4.0",
|
||||
"erlpack": "^0.1.3",
|
||||
"ts-node-dev": "^1.1.6"
|
||||
}
|
||||
}
|
||||
|
||||
BIN
util/package-lock.json
generated
BIN
util/package-lock.json
generated
Binary file not shown.
@ -32,7 +32,6 @@
|
||||
"@types/mongoose-autopopulate": "^0.10.1",
|
||||
"@types/mongoose-lean-virtuals": "^0.5.1",
|
||||
"@types/node": "^14.17.9",
|
||||
"typescript": "^4.1.3",
|
||||
"ajv": "^8.5.0",
|
||||
"amqplib": "^0.8.0",
|
||||
"dot-prop": "^6.0.1",
|
||||
@ -41,6 +40,7 @@
|
||||
"missing-native-js-functions": "^1.2.2",
|
||||
"mongodb": "^3.6.9",
|
||||
"mongoose": "^5.13.7",
|
||||
"mongoose-autopopulate": "^0.12.3"
|
||||
"mongoose-autopopulate": "^0.12.3",
|
||||
"typescript": "^4.1.3"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user