完善基础框架,对原有APILoader进行接口响应的错误处理

This commit is contained in:
tone
2024-09-25 01:21:23 +08:00
parent a9c67cd013
commit 7acdfc2c68
12 changed files with 398 additions and 0 deletions

18
src/index.ts Normal file
View File

@@ -0,0 +1,18 @@
import { APILoader } from "@lib/API/APILoader";
import Logger from '@lib/Logger/Logger'
import config from "./config";
import GetTest from "./api/GetTest";
const logger = new Logger('Server')
async function main(): Promise<void> {
logger.info('Starting...');
const apiLoader = new APILoader(config.cors);
// loadAPI
apiLoader.add(GetTest);
await apiLoader.start(config.API_Port);
logger.info('Server started successfully')
}
main().catch((reason) => {
logger.error(`An error occurs in the main function: ${reason}`)
})