Skip to content

Commit

Permalink
Environment variable added
Browse files Browse the repository at this point in the history
  • Loading branch information
ansh26748ar committed Jan 1, 2025
1 parent 646d02b commit e0833bd
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions eduaid_web/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_BASE_URL=http://localhost:5000
2 changes: 2 additions & 0 deletions eduaid_web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
The page will reload when you make changes.\
You may also see any lint errors in the console.

Rename the `.env.example` file to `.env` after setting up the project.

### `npm test`

Launches the test runner in the interactive watch mode.\
Expand Down
1 change: 1 addition & 0 deletions eduaid_web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"dotenv": "^16.4.7",
"pdf-lib": "^1.17.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion eduaid_web/src/pages/Output.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const Output = () => {
}, []);

const generateGoogleForm = async () => {
const response = await fetch("http://localhost:5000/generate_gform", {
const response = await fetch(`${process.env.REACT_APP_BASE_URL}/generate_gform`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down
6 changes: 3 additions & 3 deletions eduaid_web/src/pages/Text_Input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Text_Input = () => {
formData.append("file", file);

try {
const response = await fetch("http://localhost:5000/upload", {
const response = await fetch(`${process.env.REACT_APP_BASE_URL}/upload`, {
method: "POST",
body: formData,
});
Expand All @@ -54,7 +54,7 @@ const Text_Input = () => {
// Check if a Google Doc URL is provided
if (docUrl) {
try {
const response = await fetch("http://localhost:5000/get_content", {
const response = await fetch(`${process.env.REACT_APP_BASE_URL}/get_content`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down Expand Up @@ -122,7 +122,7 @@ const Text_Input = () => {
use_mediawiki: isToggleOn,
});

const response = await fetch(`http://localhost:5000/${endpoint}`, {
const response = await fetch(`${process.env.REACT_APP_BASE_URL}/${endpoint}`, {
method: "POST",
body: formData,
headers: {
Expand Down

0 comments on commit e0833bd

Please sign in to comment.