修正端口到3001
This commit is contained in:
@@ -37,7 +37,7 @@ export interface Student {
|
||||
|
||||
class DatabaseService {
|
||||
private static instance: DatabaseService;
|
||||
private baseUrl: string = 'http://localhost:3001/api';
|
||||
private baseUrl: string = 'http://localhost:3010/api';
|
||||
|
||||
private constructor() {
|
||||
// 直接使用服务器API,无需初始化本地数据库
|
||||
|
||||
@@ -30,10 +30,10 @@ class WebSocketService {
|
||||
// 获取当前主机地址和端口配置
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const host = window.location.hostname === 'localhost' ? 'localhost' : window.location.hostname;
|
||||
const port = process.env.NODE_ENV === 'production' ? window.location.port || '80' : '3001';
|
||||
const port = process.env.NODE_ENV === 'production' ? window.location.port || '80' : '3010';
|
||||
const socketUrl = process.env.NODE_ENV === 'production'
|
||||
? `${protocol}//${host}${port !== '80' && port !== '443' ? ':' + port : ''}`
|
||||
: `${protocol}//${host}:3001`;
|
||||
: `${protocol}//${host}:3010`;
|
||||
|
||||
console.log('🔌 连接WebSocket服务器:', socketUrl, '(环境:', process.env.NODE_ENV, ')');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user