```
feat(server): 更新默认端口为 5000 并支持环境变量配置 - 将 Web 服务器默认端口从 3000 更改为 5000 - 支持通过环境变量 PORT 自定义端口 - 添加 dotenv 依赖以加载环境变量 - 更新 README.md 中的所有相关端口说明 - 配置文件 config.json 加入 .gitignore 以防止敏感信息泄露 - 前端 API 地址改为自动检测当前域名和端口,提升部署灵活性 ```
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'dotenv/config';
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import axios from 'axios';
|
||||
@@ -7,7 +8,7 @@ import { sendReportEmail } from './emailService.js';
|
||||
import { initScheduler, runTaskNow, reloadScheduler, getSchedulerStatus } from './scheduler.js';
|
||||
|
||||
const app = express();
|
||||
const PORT = 3000;
|
||||
const PORT = process.env.PORT || 5000;
|
||||
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
Reference in New Issue
Block a user