Skip to content

Commit 29479a1

Browse files
fix: update environment variable names to VITE_API_BASE_URL in README and setup scripts
1 parent 69d9d7f commit 29479a1

3 files changed

Lines changed: 34 additions & 28 deletions

File tree

src/App/README.md

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,52 @@
1-
# Getting Started with Create React App
1+
# Frontend App (Vite + React + TypeScript)
22

3-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
3+
This project is built with [Vite](https://vitejs.dev/), React, and TypeScript.
4+
5+
## Prerequisites
6+
7+
- Node.js >= 20.0.0
8+
- npm
49

510
## Available Scripts
611

712
In the project directory, you can run:
813

9-
### `npm start`
14+
### `npm run dev`
1015

11-
Runs the app in the development mode.\
12-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
16+
Runs the app in development mode.\
17+
Open [http://localhost:5173](http://localhost:5173) to view it in the browser.
1318

14-
The page will reload if you make edits.\
15-
You will also see any lint errors in the console.
19+
The page will hot-reload when you make edits.
1620

17-
### `npm test`
21+
### `npm run build`
1822

19-
Launches the test runner in the interactive watch mode.\
20-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
23+
Type-checks with TypeScript and builds the app for production to the `dist` folder.\
24+
The build is optimized and minified for best performance.
2125

22-
### `npm run build`
26+
### `npm run preview`
27+
28+
Serves the production build locally for testing before deployment.
2329

24-
Builds the app for production to the `build` folder.\
25-
It correctly bundles React in production mode and optimizes the build for the best performance.
30+
### `npm test`
2631

27-
The build is minified and the filenames include the hashes.\
28-
Your app is ready to be deployed!
32+
Runs the test suite using [Vitest](https://vitest.dev/).
2933

30-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
34+
### `npm run test:watch`
3135

32-
### `npm run eject`
36+
Launches the test runner in interactive watch mode.
3337

34-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
38+
## Environment Variables
3539

36-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
40+
Environment variables are prefixed with `VITE_` and accessed via `import.meta.env`.
3741

38-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
42+
See `.env` for local development configuration:
3943

40-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
44+
```env
45+
VITE_API_BASE_URL=http://127.0.0.1:8000
46+
```
4147

4248
## Learn More
4349

44-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45-
46-
To learn React, check out the [React documentation](https://reactjs.org/).
50+
- [Vite Documentation](https://vitejs.dev/guide/)
51+
- [React Documentation](https://react.dev/)
52+
- [Vitest Documentation](https://vitest.dev/)

src/start.cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ for /f "tokens=1,* delims==" %%A in ('type "%ENV_FILE_FOR_ROLES%"') do (
129129
REM Write API base URL to frontend .env
130130
set APP_ENV_FILE=%ROOT_DIR%\src\App\.env
131131
(
132-
echo REACT_APP_API_BASE_URL=http://127.0.0.1:8000
132+
echo VITE_API_BASE_URL=http://127.0.0.1:8000
133133
) > "%APP_ENV_FILE%"
134-
echo Updated src/App/.env with REACT_APP_API_BASE_URL
134+
echo Updated src/App/.env with VITE_API_BASE_URL
135135

136136
REM Add or update APP_ENV="dev" in API .env file
137137
echo Checking for existing APP_ENV in src/api/.env...

src/start.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ setup_environment() {
9090

9191
# Write API base URL to frontend .env
9292
APP_ENV_FILE="$ROOT_DIR/src/App/.env"
93-
echo "REACT_APP_API_BASE_URL=http://127.0.0.1:8000" > "$APP_ENV_FILE"
94-
echo "Updated src/App/.env with REACT_APP_API_BASE_URL"
93+
echo "VITE_API_BASE_URL=http://127.0.0.1:8000" > "$APP_ENV_FILE"
94+
echo "Updated src/App/.env with VITE_API_BASE_URL"
9595

9696
# Add or update APP_ENV="dev" in API .env file
9797
echo "Checking for existing APP_ENV in src/api/.env..."

0 commit comments

Comments
 (0)