restructure and expressjs endpoints

This commit is contained in:
Fran Jurmanović
2023-10-02 21:33:22 +02:00
parent 9a9a4f2ced
commit c07e743480
26 changed files with 232 additions and 181 deletions

28
src/app.ts Normal file
View File

@@ -0,0 +1,28 @@
import { Client } from "discord.js";
import { Chat } from "@common";
import { Controller } from "@core";
import { ClientController } from "@controllers";
import express from "express";
import { config } from "@constants";
import basicAuth from "express-basic-auth";
import bodyParser from "body-parser";
const client: Client = new Client();
const chat: Chat = new Chat(client);
const app = express();
app.use(bodyParser.json());
app.use(
basicAuth({
users: {
admin: config.PASSWORD,
},
})
);
const controllers = new Controller([new ClientController(client, app)]);
controllers.register();
chat.register(config.TOKEN || "");
app.listen(config.PORT);