File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,7 +57,14 @@ onlinejudge/
5757
5858## 快速开始
5959
60- ### 1. 安装依赖
60+ ### 1. 克隆项目
61+
62+ ``` bash
63+ git clone https://github.com/anyncfunction/codejudge.git
64+ cd codejudge
65+ ```
66+
67+ ### 2. 安装依赖
6168
6269``` bash
6370# 后端
@@ -69,30 +76,32 @@ cd ../frontend
6976npm install
7077```
7178
72- ### 2 . 启动
79+ ### 3 . 启动
7380
7481``` bash
75- # 生产模式(后端同时托管前端 )
82+ # 开发模式(前后端分离,推荐 )
7683cd backend
77- npm start
78- # 访问 http://localhost:3001
84+ npm start # 后端 http://localhost:3001
85+ # 新开终端,回到项目根目录后:
86+ cd frontend
87+ npm run dev # 前端 http://localhost:5173(自动代理 /api 到后端)
7988
80- # 开发模式(前后端分离,支持热更新 )
81- cd backend && npm run dev # 后端 :3001
82- cd frontend && npm run dev # 前端 :5173(自动代理 API)
89+ # 生产模式(后端托管前端构建产物 )
90+ cd backend
91+ npm start # 访问 http://localhost:3001
8392```
8493
85- ### 3 . 构建前端
94+ ### 4 . 构建前端(可选)
8695
8796``` bash
8897cd frontend
89- npm run build # 输出到 dist/,后端自动托管
98+ npm run build # 输出到 dist/,后端自动托管
9099```
91100
92- ### 4 . Docker 部署
101+ ### 5 . Docker 部署(推荐)
93102
94103``` bash
95- docker compose up -d # 一键启动
104+ docker compose up -d # 在项目根目录执行
96105# 访问 http://localhost:3001
97106```
98107
You can’t perform that action at this time.
0 commit comments