mirror of
https://github.com/patdelphi/suanming.git
synced 2026-02-28 05:33:11 +08:00
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:
@@ -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);
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user