30 lines
959 B
TypeScript
30 lines
959 B
TypeScript
import { APILoader } from "@lib/API/APILoader";
|
|
import Logger from '@lib/Logger/Logger'
|
|
import config from "./config";
|
|
import MySQLConnection from "@lib/Database/MySQLConnection";
|
|
import RedisConnection from "@lib/Database/RedisConnection";
|
|
MySQLConnection
|
|
RedisConnection
|
|
// import API
|
|
import GetTest from "./api/GetTest";
|
|
import GetCaptcha from "./api/GetCaptcha";
|
|
import CheckCaptcha from "./api/CheckCaptcha";
|
|
import isPassedCaptcha from "./api/isPassedCaptcha";
|
|
const logger = new Logger('Server')
|
|
|
|
async function main(): Promise<void> {
|
|
logger.info('Starting...');
|
|
const apiLoader = new APILoader(config.cors);
|
|
// addAPI
|
|
apiLoader.add(GetTest);
|
|
apiLoader.add(GetCaptcha);
|
|
apiLoader.add(CheckCaptcha);
|
|
apiLoader.add(isPassedCaptcha);
|
|
|
|
await apiLoader.start(config.API_Port);
|
|
logger.info('Server started successfully')
|
|
}
|
|
|
|
main().catch((reason) => {
|
|
logger.error(`An error occurs in the main function: ${reason}`)
|
|
}) |