diff --git a/docs/en/develop/dev-config.md b/docs/en/develop/dev-config.md index 992b3598a..6fb8669e6 100644 --- a/docs/en/develop/dev-config.md +++ b/docs/en/develop/dev-config.md @@ -33,10 +33,14 @@ Install dependencies npm install ``` -Go to the `web/src/app/infra/http/HttpClient.ts` file and change `export const httpClient = new HttpClient('/');` at the bottom to `export const httpClient = new HttpClient('http://localhost:5300');` to ensure the frontend can access the standalone backend. - Start debugging ```bash -npm run dev +npm run dev:local ``` + +:::info +When using `dev:local` to start locally, the environment variable `NEXT_PUBLIC_API_BASE_URL` will be automatically used by the frontend to ensure that the frontend can access the `5300` port of the locally running backend. If you need to modify the backend address or port used, please modify the `scripts` in the `web/package.json` file. + +In production environments, the frontend will be precompiled into static files and provided by the backend, and the frontend will automatically access the backend address on the same domain. +::: diff --git a/docs/public/star.gif b/docs/public/star.gif new file mode 100644 index 000000000..b1136a2ef Binary files /dev/null and b/docs/public/star.gif differ diff --git a/docs/zh/develop/dev-config.md b/docs/zh/develop/dev-config.md index 4ef025cdf..3fdb0590c 100644 --- a/docs/zh/develop/dev-config.md +++ b/docs/zh/develop/dev-config.md @@ -33,10 +33,14 @@ uv run main.py npm install ``` -去`web/src/app/infra/http/HttpClient.ts`文件中,将最底部的`export const httpClient = new HttpClient('/');`修改为`export const httpClient = new HttpClient('http://localhost:5300');`,以确保前端可以访问到独立的后端。 - 启动调试 ```bash -npm run dev -``` \ No newline at end of file +npm run dev:local +``` + +:::info +本地使用`dev:local`启动时,会携带环境变量`NEXT_PUBLIC_API_BASE_URL`,该变量会自动被前端使用,以确保前端可以访问到本地启动的后端的`5300`端口。如果您需要修改所使用的后端地址或端口,请到`web/package.json`文件中修改`scripts`中的`dev:local`命令。 + +生产环境中,前端会被预编译成静态文件,由后端提供服务,前端会自动访问同域的后端地址。 +::: \ No newline at end of file