♻️ Move initialization code to "backend"
This commit is contained in:
21
index.ts
21
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";
|
bootstrap();
|
||||||
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();
|
|
18
src/backend/index.ts
Normal file
18
src/backend/index.ts
Normal file
@@ -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();
|
||||||
|
}
|
Reference in New Issue
Block a user