mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-11 15:48:47 +08:00
Refactor the backend
This commit is contained in:
@@ -7,7 +7,7 @@ import { DatabaseService } from "./services/DatabaseService";
|
||||
import { setupMiddlewares } from "./middleware";
|
||||
import routes from "./routes/api";
|
||||
import { logger } from "./utils/logger";
|
||||
|
||||
import { errorHandler } from "./middleware/errorHandler";
|
||||
class App {
|
||||
private app = express();
|
||||
private databaseService = container.get<DatabaseService>(TYPES.DatabaseService);
|
||||
@@ -22,6 +22,8 @@ class App {
|
||||
|
||||
// 设置路由
|
||||
this.app.use("/", routes);
|
||||
// 设置错误处理中间件
|
||||
this.app.use(errorHandler);
|
||||
}
|
||||
|
||||
public async start(): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user