fix: 修改数据库初始化的代码防止ai编写时出现循环引用
This commit is contained in:
@@ -12,7 +12,7 @@ import expressOasGenerator, {
|
||||
dotenv.config({ path: path.resolve(__dirname, "../../../.env") });
|
||||
|
||||
import "./database";
|
||||
import { sequelize } from '@/database'
|
||||
import { sequelize } from "@/database/instance";
|
||||
import { createApis } from "./api";
|
||||
|
||||
const port = process.env.PORT || 3005;
|
||||
@@ -54,9 +54,9 @@ const host = "0.0.0.0";
|
||||
app.listen(Number(port), host, async () => {
|
||||
try {
|
||||
await sequelize.sync({ alter: true });
|
||||
console.log('[server]: sequelize.sync() executed');
|
||||
console.log("[server]: sequelize.sync() executed");
|
||||
} catch (e) {
|
||||
console.error('Failed to sync database:', e);
|
||||
console.error("Failed to sync database:", e);
|
||||
}
|
||||
console.log(`[server]: Server is running at http://${host}:${port}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user