change backend PORT to BACKEND_PORT and front-3000 to 3002

This commit is contained in:
david_bai
2025-06-28 08:28:26 +08:00
parent bcd37993e6
commit b1d389ad84
11 changed files with 37 additions and 35 deletions
+2 -2
View File
@@ -64,11 +64,11 @@ Before you begin, ensure your development environment has [Node.js](https://node
# Create and configure .env.development.local according to the instructions in frontend/README.md
pnpm dev # Starts by default at http://localhost:3000
pnpm dev # Starts by default at http://localhost:3002
```
4. **Start Sharing**
Open `http://localhost:3000` in your browser to access the application.
Open `http://localhost:3002` in your browser to access the application.
## 🗺️ Roadmap
+2 -2
View File
@@ -64,11 +64,11 @@ PrivyDrop (原 SecureShare) 是一个基于 WebRTC 的开源点对点(P2P)
# 根据 frontend/README.zh-CN.md 指引创建并配置 .env.development.local
pnpm dev # 默认启动于 http://localhost:3000
pnpm dev # 默认启动于 http://localhost:3002
```
4. **开始使用**
在浏览器中打开 `http://localhost:3000` 即可访问应用。
在浏览器中打开 `http://localhost:3002` 即可访问应用。
## 🗺️ 路线图
+3 -3
View File
@@ -37,8 +37,8 @@ This is the backend server for PrivyDrop. It is built with Node.js, Express, and
```ini
# Server Configuration
PORT=3001
CORS_ORIGIN=http://localhost:3000 # URL of the frontend development server
BACKEND_PORT=3001
CORS_ORIGIN=http://localhost:3002 # URL of the frontend development server
# Redis Configuration
REDIS_HOST=127.0.0.1
@@ -50,7 +50,7 @@ This is the backend server for PrivyDrop. It is built with Node.js, Express, and
```bash
npm run dev
```
The server will start on the port specified by the `PORT` environment variable (defaults to 3001).
The server will start on the port specified by the `BACKEND_PORT` environment variable (defaults to 3001).
## 📖 API & Event Summary
+3 -3
View File
@@ -37,8 +37,8 @@
```ini
# 服务器配置
PORT=3001
CORS_ORIGIN=http://localhost:3000 # 前端开发服务器的 URL
BACKEND_PORT=3001
CORS_ORIGIN=http://localhost:3002 # 前端开发服务器的 URL
# Redis 配置
REDIS_HOST=127.0.0.1
@@ -50,7 +50,7 @@
```bash
npm run dev
```
服务器将在 `PORT` 环境变量指定的端口上启动(默认为 3001)。
服务器将在 `BACKEND_PORT` 环境变量指定的端口上启动(默认为 3001)。
## 📖 API 与事件摘要
+18 -16
View File
@@ -1,18 +1,20 @@
module.exports = {
apps: [{
name: "signaling-server",
script: "./dist/server.js", // Point to the compiled file
watch: false,
env: {
"NODE_ENV": "production",
"PORT": 3001
apps: [
{
name: "signaling-server",
script: "./dist/server.js", // Point to the compiled file
watch: false,
env: {
NODE_ENV: "production",
BACKEND_PORT: 3001,
},
log_date_format: "YYYY-MM-DD HH:mm:ss",
error_file: "/var/log/signaling-server-error.log",
out_file: "/var/log/signaling-server-out.log",
max_memory_restart: "500M",
instances: 1,
exec_mode: "fork",
group: "ssl-cert", // Add this line to specify the group the process runs as
},
log_date_format: "YYYY-MM-DD HH:mm:ss",
error_file: "/var/log/signaling-server-error.log",
out_file: "/var/log/signaling-server-out.log",
max_memory_restart: "500M",
instances: 1,
exec_mode: "fork",
group: "ssl-cert" // Add this line to specify the group the process runs as
}]
}
],
};
+2 -2
View File
@@ -3,7 +3,7 @@ import path from "path";
// Define the type for the configuration object
interface AppConfig {
PORT: number;
BACKEND_PORT: number;
CORS_ORIGIN: string;
NODE_ENV: "development" | "production";
REDIS: {
@@ -30,7 +30,7 @@ if (!process.env.REDIS_PORT) {
}
// Export the type-safe configuration object
export const CONFIG: AppConfig = {
PORT: parseInt(process.env.BACKEND_PORT || "3001", 10),
BACKEND_PORT: parseInt(process.env.BACKEND_PORT || "3001", 10),
CORS_ORIGIN: process.env.CORS_ORIGIN!,
NODE_ENV:
(process.env.NODE_ENV as "development" | "production") || "development",
+2 -2
View File
@@ -17,8 +17,8 @@ const server = http.createServer(app);
const io = new Server(server, { cors: corsWSOptions });
setupSocketHandlers(io);
server.listen(CONFIG.PORT, () => {
server.listen(CONFIG.BACKEND_PORT, () => {
console.log(
`Signaling server running in ${CONFIG.NODE_ENV} mode on port ${CONFIG.PORT}`
`Signaling server running in ${CONFIG.NODE_ENV} mode on port ${CONFIG.BACKEND_PORT}`
);
});
+1 -1
View File
@@ -198,7 +198,7 @@ In production, Nginx will act as the entry point for all traffic, handling SSL t
- **Backend:**
- Create a `.env.production.local` file in the `backend/` directory.
- Fill in the necessary environment variables (e.g., `PORT`, `REDIS_HOST`, `REDIS_PORT`, `CORS_ORIGIN`).
- Fill in the necessary environment variables (e.g., `BACKEND_PORT`, `REDIS_HOST`, `REDIS_PORT`, `CORS_ORIGIN`).
- For Nginx integration, also add `NGINX_SERVER_NAME`, `NGINX_SSL_CERT`, `NGINX_SSL_KEY`, and `NGINX_FRONTEND_ROOT`.
- **Frontend:**
- Create a `.env.production.local` file in the `frontend/` directory.
+1 -1
View File
@@ -33,7 +33,7 @@ Before you start, please ensure you have **installed and started the backend ser
```bash
pnpm dev
```
5. Open `http://localhost:3000` in your browser to see the application.
5. Open `http://localhost:3002` in your browser to see the application.
## 📚 Detailed Documentation
+1 -1
View File
@@ -33,7 +33,7 @@
```bash
pnpm dev
```
5. 在浏览器中打开 `http://localhost:3000` 即可看到应用界面。
5. 在浏览器中打开 `http://localhost:3002` 即可看到应用界面。
## 📚 详细文档
+2 -2
View File
@@ -3,9 +3,9 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -H 0.0.0.0",
"dev": "next dev -H 0.0.0.0 -p 3002",
"build": "next build",
"start": "next start",
"start": "next start -p 3000",
"lint": "next lint"
},
"dependencies": {