From 41aaec835fddb39ab71b7a585b81542c009313fc Mon Sep 17 00:00:00 2001 From: alexbcberio Date: Fri, 18 Jun 2021 19:04:14 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Move=20initialization=20co?= =?UTF-8?q?de=20to=20"backend"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.ts | 21 ++------------------- src/backend/index.ts | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 19 deletions(-) create mode 100644 src/backend/index.ts diff --git a/index.ts b/index.ts index 66a261c..226c0f7 100644 --- a/index.ts +++ b/index.ts @@ -1,20 +1,3 @@ -import { getApiClient, getAuthProvider, } from "./src/backend/helpers/twitch"; +import { bootstrap } from "./src/backend"; -import { connect } from "./src/backend/chatClient"; -import { listen, } from "./src/backend/webServer"; -import { registerUserListener } from "./src/backend/pubSubClient"; - -const channel = "alexbcberio"; - -async function init() { - - const apiClient = await getApiClient(); - await registerUserListener(apiClient, channel); - - const authProvider = await getAuthProvider(); - await connect(authProvider, [channel]); - - listen(); -} - -init(); \ No newline at end of file +bootstrap(); \ No newline at end of file diff --git a/src/backend/index.ts b/src/backend/index.ts new file mode 100644 index 0000000..94e4f48 --- /dev/null +++ b/src/backend/index.ts @@ -0,0 +1,18 @@ +import { getApiClient, getAuthProvider } from "./helpers/twitch"; + +import { connect } from "./chatClient"; +import { listen } from "./webServer"; +import { registerUserListener } from "./pubSubClient"; + +const channel = "alexbcberio"; + +export async function bootstrap() { + + const apiClient = await getApiClient(); + await registerUserListener(apiClient, channel); + + const authProvider = await getAuthProvider(); + await connect(authProvider, [channel]); + + listen(); +} \ No newline at end of file