Fix API configuration and test production build

- Updated .env file with correct VITE_API_BASE_URL for local development
- Fixed API endpoint routing from localhost:5173 to localhost:3001
- Tested npm run build successfully with no errors
- Updated database and server configurations
This commit is contained in:
patdelphi
2025-08-19 18:47:26 +08:00
parent 9472fa8af7
commit 858a0961b5
6 changed files with 41 additions and 4 deletions

View File

@@ -15,6 +15,12 @@ class DatabaseManager {
// 初始化数据库连接
init() {
try {
// 确保数据库目录存在
const dbDir = path.dirname(this.dbPath);
if (!fs.existsSync(dbDir)) {
fs.mkdirSync(dbDir, { recursive: true });
}
// 创建或连接到SQLite数据库
this.db = new Database(this.dbPath);

View File

@@ -43,7 +43,7 @@ app.use(helmet({
app.use(cors({
origin: process.env.NODE_ENV === 'production'
? (origin, callback) => {
// 允许Koyeb域名、localhost和环境变量指定的域名
// 生产环境的严格检查
const allowedOrigins = [
'http://localhost:5173',
'http://localhost:4173',